-
Notifications
You must be signed in to change notification settings - Fork 116
feat: init @lynx-js/lynx-bundle-rslib-config #1943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 215c7ea The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 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 |
📝 WalkthroughWalkthroughAdds a new package Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (6)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)
17-123: Good integration coverage of config and bundle behaviorThe tests exercise both the configuration helper (entry preservation/overrides) and actual bundle outputs for dual/main-thread/background cases, including verifying custom section names and
.define(presence. Using distinct bundle IDs avoids cross-test interference even though they share the samedistdirectory; if you ever see flakes in watch mode, consider cleaning or isolating that directory per test, but current setup is fine.packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
5-53: Docs are clear; tiny improvement for React exampleThe usage and step‑by‑step instructions are very helpful. For the React snippet, you might consider adding a dependency array, e.g.
useEffect(() => { /* ... */ }, []), so the example doesn’t imply refetching the bundle on every render. Optional, but more idiomatic.packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
6-15: Decoupletestoption typing fromBannerPlugininternalsUsing
BannerPlugin['options']['test']ties this option to both the existence of a namedBannerPluginexport and its instance shape. A simpler and more robust option is to mirror webpack’s documented union directly, e.g.:interface MainThreadRuntimeWrapperWebpackPluginOptions { test?: string | RegExp | (string | RegExp)[] }You can still accept a
Partial<MainThreadRuntimeWrapperWebpackPluginOptions>in the constructor and default to/\.js$/as you already do. This avoids potential breakage if webpack’s internal typings change while keeping call‑sites just as ergonomic.Please double‑check the current webpack typings in your installed version to confirm whether
import type { BannerPlugin } from 'webpack'is actually valid, and adjust the type as above if you prefer to avoid that dependency.Also applies to: 22-37
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)
7-27: API report looks consistent; unresolved-link warnings can be cleaned upThe report correctly captures the public surface (
defaultExternalBundleLibConfig,defaultExternalBundleRsbuildConfig,defineExternalBundleRslibConfig,LAYERS). Theae-unresolved-linkwarnings aroundLibConfigsuggest a TSDoc@linkin the TS sources pointing atLibConfigas if it were exported from this package. If you want a clean report, update that JSDoc to reference the type from@rslib/coreusing a fully qualified TSDoc reference, then re‑runpnpm turbo api-extractor -- --localto regenerate this file. Do not hand‑edit the report.packages/rspeedy/lynx-bundle-rslib-config/package.json (1)
1-50: Align dependencies and changesets with repo conventionsTwo small packaging points to consider:
@rslib/coreas a peer dependency
Your public API (per the API report) exposesLibConfig/RslibConfigfrom@rslib/core. Right now@rslib/coreis only a devDependency. To make consumer ergonomics clearer and versioning safer, it’s worth adding a matching entry underpeerDependencies(and keeping the devDependency for local tests/build). This way, projects using this package get an explicit requirement to install a compatible@rslib/core.Changeset for the new src package
Since this adds a newsrcpackage, CI in this repo generally expects a changeset, even for internal/private changes; when release notes aren’t needed, an “empty” changeset file is used to satisfy the requirement, and it must reference the exact package name frompackage.json#name. Please confirm that a changeset for@lynx-js/lynx-bundle-rslib-configis included in the PR.Based on learnings
packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1)
54-76: Slightly simplifycustomSectionsconstruction to avoid repeated object spreadsThe current
filter(...).reduce({...prev, ...})pattern recreates a new object on every iteration. For many assets this is a bit wasteful and less straightforward to read. You can build the same map in a single pass without repeated spreads:- async #encode(assets: Readonly<Asset>[]) { - const customSections = assets - .filter(({ name }) => name.endsWith('.js')) - .reduce<Record<string, { content: string }>>((prev, cur) => ({ - ...prev, - [cur.name.replace('.js', '')]: { - content: cur.source.source().toString(), - }, - }), {}) + async #encode(assets: Readonly<Asset>[]) { + const customSections: Record<string, { content: string }> = {} + + for (const { name, source } of assets) { + if (!name.endsWith('.js')) continue + customSections[name.replace('.js', '')] = { + content: source.source().toString(), + } + }The rest of the method can stay as-is. This keeps behavior identical while reducing allocations and improving readability.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (18)
packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
packages/**/etc/*.api.md
📄 CodeRabbit inference engine (AGENTS.md)
Always commit API extractor output after running
pnpm turbo api-extractor -- --local(commit updated API report files)
Files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (23)
📓 Common learnings
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/README.mdpackages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonwebsite/rspress.config.tspackages/rspeedy/lynx-bundle-rslib-config/test/utils.tspackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/README.mdwebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonwebsite/rspress.config.tspackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/README.mdwebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonwebsite/rspress.config.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/README.mdwebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonwebsite/rspress.config.tspackages/rspeedy/lynx-bundle-rslib-config/test/utils.tspackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/README.mdwebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/README.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
website/package.jsonpackages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Applied to files:
website/package.jsonpackages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
website/package.jsonpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
website/package.jsonwebsite/rspress.config.tspackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.
Applied to files:
website/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.
Applied to files:
packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.
Applied to files:
packages/rspeedy/tsconfig.json
🧬 Code graph analysis (4)
website/rspress.config.ts (1)
website/sidebars/api.ts (1)
createAPI(155-192)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
MainThreadRuntimeWrapperWebpackPlugin(17-39)packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1)
LazyBundleWebpackPlugin(11-80)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
defineExternalBundleRslibConfig(233-248)LAYERS(17-20)packages/rspeedy/core/src/cli/build.ts (1)
build(23-80)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
decodeTemplate(11-22)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1)
compiler(40-52)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
[warning] 150-150: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 155-155: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (20)
packages/webpack/template-webpack-plugin/package.json (1)
40-40: No changeset is required for this change.The PR only modified
packages/webpack/template-webpack-plugin/package.json(bumping the@lynx-js/tasmdependency from 0.0.18 to 0.0.19). No source files (src/**) in the package were changed. According to the repository's changeset configuration, changesets are only required when files matching the patternsrc/**are modified. Since this is purely a dependency version update inpackage.json, no changeset entry is needed.Likely an incorrect or invalid review comment.
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1)
1-6: LGTM!The API Extractor configuration follows the standard pattern used across the repository and correctly extends the base configuration.
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1)
1-10: LGTM!The TypeScript build configuration correctly sets up composite project references and follows the established pattern used across the repository.
packages/rspeedy/lynx-bundle-rslib-config/README.md (1)
1-3: LGTM!The README provides a clear, concise description of the package's purpose. Consider adding usage examples or API documentation links in future iterations for better developer experience.
packages/rspeedy/tsconfig.json (1)
12-12: LGTM!The project reference correctly integrates the new lynx-bundle-rslib-config package into the TypeScript composite project setup and maintains alphabetical ordering.
website/rspress.config.ts (2)
67-69: LGTM!The API documentation entry for lynx-bundle-rslib-config correctly follows the established pattern and appropriately places the new package in the Rspeedy section.
207-210: LGTM!The Chinese API documentation entry correctly mirrors the English configuration with the appropriate base path for localization.
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1)
1-8: LGTM!The TypeScript configuration correctly extends the build config and sets up type checking for source and test files without emitting output.
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1)
1-10: LGTM!The Vitest configuration correctly sets up the test workspace project with an appropriate name that follows the repository's naming convention.
website/package.json (1)
24-24: LGTM!The workspace dependency is correctly added in alphabetical order, enabling the website to reference the new package for API documentation generation.
packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1)
1-3: Fixture helper is correct and minimalThe
addhelper does exactly what's needed for the fixture, with clear typing and no edge cases to worry about.packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
1-22: Test decode helper looks appropriateLazy-loading
@lynx-js/tasm, reading the bundle, and narrowing to the minimalDecodeTemplateResultshape is a good fit for this test-only helper; the eslint suppression is localized and acceptable here.packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
54-59: Public exports align with the intended API surfaceRe‑exporting
defineExternalBundleRslibConfig,defaultExternalBundleLibConfig,defaultExternalBundleRsbuildConfig, andLAYERSmatches the generated API report and keeps the entrypoint focused. Just ensure that whenever you adjust these exports you re‑runpnpm turbo api-extractor -- --localsoetc/lynx-bundle-rslib-config.api.mdstays in sync, as per the repo’s guidelines.packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (7)
1-20: LGTM! Clean imports and constant definition.The LAYERS constant with
as constassertion provides proper type safety, and the imports are well-organized.
27-40: LGTM! Well-configured lib defaults.The configuration appropriately bundles dependencies and disables unsupported Lynx features like
import.meta.urlshim.
49-63: LGTM! Minification options preserve module wrapper semantics.The
negate_iife: falseandside_effects: falsesettings correctly preserve the IIFE structure and return value required by Lynx's module loader.
69-146: LGTM! Entry duplication logic correctly handles layer-based bundling.The logic appropriately:
- Duplicates string/array entries into dual main-thread and background variants
- Preserves explicit layer assignments from object-valued entries
- Falls back to dual entries when layer is unspecified
The naming convention (background keeps original name, main-thread adds
__main-threadsuffix) aligns with the documented examples.
150-150: Entry names are developer-controlled, ReDoS risk is minimal.While static analysis flags RegExp construction from variables, the
namevalues originate from user-configured entry names (e.g., "utils", "index"), which are developer-controlled identifiers. The pattern${name}\\.js$is simple and poses minimal ReDoS risk in practice. However, if entry names ever come from external or untrusted sources, consider validating them against a safe pattern.Also applies to: 155-155
250-268: LGTM! Lazy loading and plugin registration are properly implemented.The dynamic import of
@lynx-js/tasmavoids loading the dependency until needed, and the template filename generation fromlibNameis appropriate for the bundle output.
148-158: Code review verified: no issues found.Webpack BannerPlugin officially supports
test: string | RegExp | [string, RegExp], confirming the implementation at lines 148-158 is correct. BothMainThreadRuntimeWrapperWebpackPluginandBackgroundRuntimeWrapperWebpackPluginproperly pass arrays of RegExp patterns generated via.map(), which aligns with webpack's specification.
CodSpeed Performance ReportMerging #1943 will degrade performances by 11.83%Comparing Summary
Benchmarks breakdown
Footnotes
|
Web Explorer#6421 Bundle Size — 377.48KiB (0%).215c7ea(current) vs 2cd5c0c main#6405(baseline) Bundle metrics
Bundle size by type
|
| Current #6421 |
Baseline #6405 |
|
|---|---|---|
243.15KiB |
243.15KiB |
|
101.94KiB |
101.94KiB |
|
32.38KiB |
32.38KiB |
Bundle analysis report Branch luhc228:lynx-bundle-rslib-config Project dashboard
Generated by RelativeCI Documentation Report issue
8e56d8f to
647b2fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1)
233-268: SpreaddefaultExternalBundleRsbuildConfiginto the lib item, not at the RslibConfig root
defaultExternalBundleRsbuildConfigis explicitly typed asRslibConfig['lib'][0], i.e., it has lib‑level fields such asoutput,source, andtools. IndefineExternalBundleRslibConfig, it is currently spread at the top level:return { lib: [ { ...defaultExternalBundleLibConfig, ...userLibConfig, }, ], ...defaultExternalBundleRsbuildConfig, plugins: [lazyBundleRsbuildPlugin], }This mixes lib‑level properties into the root
RslibConfigobject rather than into the single lib entry, which is exactly the type mismatch that was already called out in the earlier review. A safer and more accurate shape is to merge the default rsbuild config into the lib item itself and keep root‑level fields limited tolibandplugins:export function defineExternalBundleRslibConfig( userLibConfig: LibConfig, ): RslibConfig { return { lib: [ { ...defaultExternalBundleLibConfig, - ...userLibConfig, + ...defaultExternalBundleRsbuildConfig, + ...userLibConfig, }, ], - ...defaultExternalBundleRsbuildConfig, plugins: [ lazyBundleRsbuildPlugin, ], } }This way:
- All
output/source/toolssettings fromdefaultExternalBundleRsbuildConfiglive where their type (RslibConfig['lib'][0]) says they should.- The returned
RslibConfigaligns structurally with how lib configs are normally expressed, reducing the risk of subtle misbehavior in@rslib/core.Please double‑check this against the current
@rslib/coreRslibConfig/LibConfigdocumentation to confirm thatoutput,source, andtoolsare indeed intended to be lib‑level here.
🧹 Nitpick comments (3)
packages/rspeedy/lynx-bundle-rslib-config/package.json (1)
1-50: Package manifest looks coherent with the new rslib config package
exports,files, and dependency wiring line up with the src/lib/test usage, and@lynx-js/tasmis correctly listed as a runtime dependency.engines.node: ">=18"is fine, but if the intention is to strictly match the workspace’s Node requirement (>=22), you may want to align this in a follow‑up for consistency.packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
4-38: IIFE wrapper plugin is minimal and consistent with existing runtime patternsThe plugin cleanly injects a raw IIFE that creates
module/exportsand returnsmodule.exports, with a configurabletestpredicate defaulting to/\.js$/. This aligns with the existing runtime-wrapper approach and keeps the main-thread wrapper logic small and focused.If you ever need to extend the wrapper (e.g., adding
'use strict';or additional locals), consider factoring the banner strings into small helper functions for readability, but it’s not necessary right now.packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1)
47-161: Entry duplication and wrapper plugin wiring are correct; consider escaping entry names in regex testsThe
bundlerChain:
- Copies existing entries, then expands them into main-thread/background variants based on
LAYERSand whetherlayeris explicitly set, which matches the intended semantics and the test expectations.- Tracks entry names in
mainThreadEntryNameandbackgroundEntryNameand wiresMainThreadRuntimeWrapperWebpackPluginandBackgroundRuntimeWrapperWebpackPluginwithtestpredicates tailored per entry, which is a nice, targeted use of the wrappers.One thing to optionally tighten up:
testis built asnew RegExp(\${name}\.js$ `)from the raw entry names. While the patterns here are simple and only used at build time, this means any regex metacharacters inname(e.g.,+,(,),|`) will be interpreted as regex, not literal text (and static analysis flagged this).- You could make this more robust by escaping
namefirst, e.g.:- test: mainThreadEntryName.map((name) => new RegExp(`${name}\\.js$`)), + test: mainThreadEntryName.map((name) => { + const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + return new RegExp(`${escaped}\\.js$`) + }),(and similarly for
backgroundEntryName).This keeps behavior identical for today’s simple entry names but avoids surprises if someone ever uses an entry name with regex metacharacters.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
-
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (18)
-
packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks) -
packages/rspeedy/tsconfig.json(1 hunks) -
packages/webpack/template-webpack-plugin/package.json(1 hunks) -
website/package.json(1 hunks) -
website/rspress.config.ts(2 hunks)
✅ Files skipped from review due to trivial changes (2)
- packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
- packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (11)
- website/package.json
- packages/webpack/template-webpack-plugin/package.json
- packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
- packages/rspeedy/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- website/rspress.config.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts
- packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.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/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
🧬 Code graph analysis (3)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
packages/webpack/runtime-wrapper-webpack-plugin/src/RuntimeWrapperWebpackPlugin.ts (1)
RuntimeWrapperWebpackPluginImpl(136-208)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
defineExternalBundleRslibConfig(233-248)LAYERS(17-20)packages/rspeedy/core/src/cli/build.ts (1)
build(23-80)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
decodeTemplate(11-22)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
MainThreadRuntimeWrapperWebpackPlugin(17-39)packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1)
LazyBundleWebpackPlugin(11-80)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
[warning] 150-150: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 155-155: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: build / Build (Ubuntu)
- GitHub Check: build / Build (Windows)
- GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (2)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)
5-123: Strong, focused integration tests for external bundle configThe suite exercises both config shaping (entry + syntax override) and the main/background splitting semantics via decoded bundle sections, which gives good confidence in
defineExternalBundleRslibConfigandLAYERSwithout over-mocking. The distinct ids (utils-dual,utils-m,utils-b) keep artifacts separated enough for repeated runs.packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1)
17-40: LAYERS constant and default lib config look well-chosen for Lynx external bundles
LAYERSexposes exactly the two public layer identifiers used by the tests and bundlerChain logic ('background'and'main-thread').defaultExternalBundleLibConfig’sformat: 'cjs',syntax: 'es2015', disabledautoExtension, andimport.meta.urlshim suppression are all reasonable defaults for Lynx bundles and keep the generated JS predictable.
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Show resolved
Hide resolved
3ae65f9 to
35cfb96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (19)
.changeset/stale-rings-tan.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- .changeset/stale-rings-tan.md
🚧 Files skipped from review as they are similar to previous changes (10)
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- website/rspress.config.ts
- packages/rspeedy/tsconfig.json
- packages/webpack/template-webpack-plugin/package.json
- packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
🧰 Additional context used
📓 Path-based instructions (1)
packages/**/etc/*.api.md
📄 CodeRabbit inference engine (AGENTS.md)
Always commit API extractor output after running
pnpm turbo api-extractor -- --local(commit updated API report files)
Files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (22)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
website/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Applied to files:
website/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.
Applied to files:
website/package.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
🧬 Code graph analysis (3)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
defineExternalBundleRslibConfig(233-248)LAYERS(17-20)packages/rspeedy/core/src/cli/build.ts (1)
build(23-80)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
decodeTemplate(11-25)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
MainThreadRuntimeWrapperWebpackPlugin(17-39)packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1)
LazyBundleWebpackPlugin(11-80)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
packages/webpack/runtime-wrapper-webpack-plugin/src/RuntimeWrapperWebpackPlugin.ts (2)
RuntimeWrapperWebpackPluginImpl(136-208)RuntimeWrapperWebpackPluginImpl(136-208)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
[warning] 150-150: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 155-155: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Outdated
Show resolved
Hide resolved
35cfb96 to
a104f5c
Compare
packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts
Outdated
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Outdated
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
Outdated
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
Show resolved
Hide resolved
a104f5c to
44e8f15
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (3)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (3)
156-220: Fix invalid import paths in JSDoc examples.The JSDoc examples on lines 169, 192, and 213 use the invalid relative path
'.src/utils.ts'. This should be'./src/utils.ts'to match typical rsbuild configs and ensure users can copy-paste working examples.
138-143: Escape entry names before constructing RegExp.Lines 138 and 143 construct regular expressions directly from entry names without escaping. If an entry name contains regex metacharacters (e.g.,
[,.,(), this could cause RegExp construction to fail or match unintended files, and potentially enable ReDoS attacks.Apply escaping before building the patterns:
+const escapeRegex = (str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + // dprint-ignore chain .plugin(MainThreadRuntimeWrapperWebpackPlugin.name) .use(MainThreadRuntimeWrapperWebpackPlugin, [{ - test: mainThreadEntryName.map((name) => new RegExp(`${name}\\.js$`)), + test: mainThreadEntryName.map((name) => new RegExp(`${escapeRegex(name)}\\.js$`)), }]) .end() .plugin(BackgroundRuntimeWrapperWebpackPlugin.name) .use(BackgroundRuntimeWrapperWebpackPlugin, [{ - test: backgroundEntryName.map((name) => new RegExp(`${name}\\.js$`)), + test: backgroundEntryName.map((name) => new RegExp(`${escapeRegex(name)}\\.js$`)), }]) .end()
221-236: Fix type mismatch: move lib-level config spread into lib array.Line 231 spreads
defaultExternalBundleRsbuildConfigat the root level of the returnedRslibConfig, butdefaultExternalBundleRsbuildConfigis typed asRslibConfig['lib'][0](aLibConfig). This incorrectly mixes lib-level properties (output,source,tools) with root-level properties (lib,plugins).Move the spread inside the lib array item:
export function defineExternalBundleRslibConfig( userLibConfig: LibConfig, ): RslibConfig { return { lib: [ { ...defaultExternalBundleLibConfig, + ...defaultExternalBundleRsbuildConfig, ...userLibConfig, }, ], - ...defaultExternalBundleRsbuildConfig, plugins: [ - lazyBundleRsbuildPlugin(), + lazyBundleRsbuildPlugin(), ], } }
🧹 Nitpick comments (2)
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)
7-27: Confirm API report is regenerated and matches the new public surfaceThis file looks like a fresh API Extractor output, but it only contains the config helpers and
LAYERSwhilesrc/index.tsalso re-exports the webpack plugins. If those plugins are intended to be public, please re-runpnpm turbo api-extractor -- --localand confirm this report is up to date; if they’re intentionally internal, consider keeping them out ofsrc/index.tsexports or documenting that choice. The unresolved-link warnings forLibConfigshould likewise be fixed in the source JSDoc (not in this file) if you want clean API docs.packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)
75-83: Simplify and optimizecustomSectionsconstructionThe current
reducewith object spread recreates the object on every iteration. A simple loop keeps the same behavior with less allocation and slightly clearer intent:- const customSections = assets - .filter(({ name }) => name.endsWith('.js')) - .reduce<Record<string, { content: string }>>((prev, cur) => ({ - ...prev, - [cur.name.replace('.js', '')]: { - content: cur.source.source().toString(), - }, - }), {}) + const customSections: Record<string, { content: string }> = {} + for (const asset of assets) { + if (!asset.name.endsWith('.js')) continue + customSections[asset.name.replace('.js', '')] = { + content: asset.source.source().toString(), + } + }Behavior stays the same while avoiding repeated spreads on every asset.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (19)
.changeset/stale-rings-tan.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
- packages/rspeedy/tsconfig.json
- website/rspress.config.ts
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/package.json
- packages/webpack/template-webpack-plugin/package.json
- packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
- packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
For contributions, generate and commit a Changeset describing your changes
Files:
.changeset/stale-rings-tan.md
packages/**/etc/*.api.md
📄 CodeRabbit inference engine (AGENTS.md)
Always commit API extractor output after running
pnpm turbo api-extractor -- --local(commit updated API report files)
Files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (32)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
website/package.json.changeset/stale-rings-tan.md
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/test/utils.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.
Applied to files:
website/package.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/test/utils.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.
Applied to files:
website/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-07-16T05:57:29.837Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T05:57:29.837Z
Learning: In the lynx-stack codebase, PupilTong prefers avoiding regex for parsing in performance-critical code paths like SSR hydration, preferring simple string manipulation operations even if they're less robust, when the input format is predictable and controlled.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
🧬 Code graph analysis (3)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
MainThreadRuntimeWrapperWebpackPlugin(56-56)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)
compiler(49-73)packages/webpack/runtime-wrapper-webpack-plugin/src/RuntimeWrapperWebpackPlugin.ts (2)
RuntimeWrapperWebpackPluginImpl(136-208)RuntimeWrapperWebpackPluginImpl(136-208)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
LazyBundleWebpackPlugin(55-55)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
MainThreadRuntimeWrapperWebpackPlugin(17-39)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)
LazyBundleWebpackPlugin(20-105)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (5)
website/package.json (1)
24-24: LGTM!Dependency correctly added to devDependencies with
workspace:*protocol, maintaining alphabetical order among scoped packages. Appropriate placement for a build configuration tool..changeset/stale-rings-tan.md (1)
1-22: Changeset content and package naming look goodFront‑matter uses the exact scoped package name and a
patchbump, and the body includes a clear usage example, which is helpful for consumers and aligns with the repo’s changeset conventions.packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
5-25: Test decode helper is straightforward and appropriateThe
decodeTemplatehelper cleanly abstracts the@lynx-js/tasmdecode logic for tests, including the Windows/N-API switch and fs read, with a minimal result type focused oncustom-sections. Looks good as a focused test utility.packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
5-56: Documentation and public exports are cohesiveThe package-level JSDoc gives a clear end‑to‑end flow (install → rslib config → fetching/loading the bundle), and the index re-exports both the config helpers and the webpack plugins from a single entrypoint, which is nice for consumers. No issues from my side.
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
1-39: LGTM! Plugin correctly wraps modules for Lynx runtime.The MainThreadRuntimeWrapperWebpackPlugin implementation is clean and correct. The IIFE wrapper pattern with module.exports is confirmed necessary for lynx-core integration (per past review discussion). The two-BannerPlugin approach effectively creates the wrapper opening and closing, and the default test regex
/\.js$/appropriately targets JavaScript files.
44e8f15 to
95ffcf4
Compare
React Example#6261 Bundle Size — 236.09KiB (0%).215c7ea(current) vs 2cd5c0c main#6245(baseline) Bundle metrics
|
| Current #6261 |
Baseline #6245 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
4 |
4 |
|
162 |
162 |
|
65 |
65 |
|
46.71% |
46.71% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #6261 |
Baseline #6245 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
90.33KiB |
90.33KiB |
Bundle analysis report Branch luhc228:lynx-bundle-rslib-config Project dashboard
Generated by RelativeCI Documentation Report issue
95ffcf4 to
d4c37b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.changeset/stale-rings-tan.md (1)
1-3: Consider bumping tominorfor new package initialization.For a new package being added to the monorepo, a
minorversion bump is typically more appropriate thanpatch. Thepatchlevel is generally reserved for bug fixes in existing packages, whileminorindicates new functionality or new packages being introduced.Apply this diff to adjust the version level:
-"@lynx-js/lynx-bundle-rslib-config": patch +"@lynx-js/lynx-bundle-rslib-config": minorpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)
31-49: Address API Extractor warnings for better API documentation.The API report shows warnings that should be addressed:
- Missing
@publicrelease tags onLazyBundleWebpackPluginandMainThreadRuntimeWrapperWebpackPluginclasses- Option interfaces (
LazyBundleWebpackPluginOptionsandMainThreadRuntimeWrapperWebpackPluginOptions) need to be exportedFix 1: Add @public tags to plugin classes
In
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts:+/** + * @public + */ export class LazyBundleWebpackPlugin {In
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts:+/** + * @public + */ export class MainThreadRuntimeWrapperWebpackPlugin {Fix 2: Export option interfaces
In
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts:-interface LazyBundleWebpackPluginOptions { +export interface LazyBundleWebpackPluginOptions {In
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts:-interface MainThreadRuntimeWrapperWebpackPluginOptions { +export interface MainThreadRuntimeWrapperWebpackPluginOptions {Then re-export them from
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts:export { LazyBundleWebpackPlugin } from './webpack/LazyBundleWebpackPlugin.js' +export type { LazyBundleWebpackPluginOptions } from './webpack/LazyBundleWebpackPlugin.js' export { MainThreadRuntimeWrapperWebpackPlugin } from './webpack/MainThreadRuntimeWrapperWebpackPlugin.js' +export type { MainThreadRuntimeWrapperWebpackPluginOptions } from './webpack/MainThreadRuntimeWrapperWebpackPlugin.js'After making these changes, run
pnpm turbo api-extractor -- --localto update the API report.
📜 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 (19)
.changeset/stale-rings-tan.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
- packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
- website/package.json
- packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
- website/rspress.config.ts
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- packages/webpack/template-webpack-plugin/package.json
- packages/rspeedy/tsconfig.json
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
For contributions, generate and commit a Changeset describing your changes
Files:
.changeset/stale-rings-tan.md
packages/**/etc/*.api.md
📄 CodeRabbit inference engine (AGENTS.md)
Always commit API extractor output after running
pnpm turbo api-extractor -- --local(commit updated API report files)
Files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (27)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts.changeset/stale-rings-tan.md
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.md
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts.changeset/stale-rings-tan.md
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.md
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
🧬 Code graph analysis (2)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
defineExternalBundleRslibConfig(49-49)LAYERS(52-52)packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
defineExternalBundleRslibConfig(221-236)LAYERS(17-20)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
decodeTemplate(11-25)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
MainThreadRuntimeWrapperWebpackPlugin(17-39)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)
LazyBundleWebpackPlugin(20-105)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (3)
.changeset/stale-rings-tan.md (2)
1-3: Verify the exact package name matchespackage.json#name.Ensure
@lynx-js/lynx-bundle-rslib-configmatches the scoped name in the package.json for this new package. As per learnings, changesets should use the exact package name from package.json to ensure proper release tracking.
5-22: Changelog entry provides clear context with relevant example.The description effectively communicates the purpose of the new package with a concrete code example showing the primary API (
defineExternalBundleRslibConfigandLAYERS). This aligns well with the exports introduced in the new package.packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)
16-16: UsetoLowerCase()instead of non-standardtoLocaleLowerCase().Line 16 uses
toLocaleLowerCase(), which is a non-standard method. Use the standardtoLowerCase()instead.Apply this diff:
- const values = process.env['DEBUG'].toLocaleLowerCase().split(',') + const values = process.env['DEBUG'].toLowerCase().split(',')⛔ Skipped due to learnings
Learnt from: Sherry-hue Repo: lynx-family/lynx-stack PR: 1770 File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318 Timestamp: 2025-09-18T08:12:56.802Z Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
d4c37b6 to
85653cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
136-145: Escape entry names before buildingRegExppatterns
mainThreadEntryName/backgroundEntryNamevalues ultimately come from user‑defined entry names, but they are interpolated directly intonew RegExp(\${name}\.js$ `). If an entry name contains regex metacharacters (e.g.[,(,.,+), this can mis‑match or even throw at runtime when constructing theRegExp`. Static analysis also flags this as a “regexp-from-variable” issue.Recommend escaping the names once and reusing that helper when creating the tests:
@@ -export const defaultExternalBundleRsbuildConfig: RslibConfig['lib'][0] = { +export const defaultExternalBundleRsbuildConfig: RslibConfig['lib'][0] = { @@ tools: { bundlerChain: (chain) => { @@ Object.entries(entries).forEach(([entryName, entryPoint]) => { @@ }) - // dprint-ignore - chain - .plugin(MainThreadRuntimeWrapperWebpackPlugin.name) - .use(MainThreadRuntimeWrapperWebpackPlugin, [{ - test: mainThreadEntryName.map((name) => new RegExp(`${name}\\.js$`)), - }]) - .end() - .plugin(BackgroundRuntimeWrapperWebpackPlugin.name) - .use(BackgroundRuntimeWrapperWebpackPlugin, [{ - test: backgroundEntryName.map((name) => new RegExp(`${name}\\.js$`)), - }]) - .end() + const escapeRegex = (value: string): string => + value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + + // dprint-ignore + chain + .plugin(MainThreadRuntimeWrapperWebpackPlugin.name) + .use(MainThreadRuntimeWrapperWebpackPlugin, [{ + test: mainThreadEntryName.map( + (name) => new RegExp(`${escapeRegex(name)}\\.js$`), + ), + }]) + .end() + .plugin(BackgroundRuntimeWrapperWebpackPlugin.name) + .use(BackgroundRuntimeWrapperWebpackPlugin, [{ + test: backgroundEntryName.map( + (name) => new RegExp(`${escapeRegex(name)}\\.js$`), + ), + }]) + .end()This keeps the semantics (literal filename match) while avoiding unexpected regex behavior or construction errors when entry names contain special characters.
🧹 Nitpick comments (3)
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (2)
1-2: Optionally combine imports from the same module.The imports are correct and functional. For brevity, you could combine them into a single import statement.
Apply this diff to combine the imports:
-import { defineProject } from 'vitest/config' -import type { UserWorkspaceConfig } from 'vitest/config' +import { defineProject, type UserWorkspaceConfig } from 'vitest/config'
4-10: Optionally simplify with direct export.The configuration is correct and the test name properly reflects the package structure. The explicit type annotation is redundant since
defineProjectalready returns the correct type, and the intermediate variable could be eliminated.Apply this diff to simplify:
-const config: UserWorkspaceConfig = defineProject({ +export default defineProject({ test: { name: 'rspeedy/lynx-bundle-rslib-config', }, }) - -export default configpackages/rspeedy/lynx-bundle-rslib-config/README.md (1)
1-3: Minimal README is fine; consider adding usage laterThe short description is accurate for init. Over time, consider adding a tiny config example using
defineExternalBundleRslibConfigto make the package more self‑discoverable.
📜 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 (19)
-
.changeset/stale-rings-tan.md(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks) -
packages/rspeedy/tsconfig.json(1 hunks) -
packages/webpack/template-webpack-plugin/package.json(1 hunks) -
website/package.json(1 hunks) -
website/rspress.config.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
- .changeset/stale-rings-tan.md
- packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
- packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
- packages/rspeedy/tsconfig.json
🧰 Additional context used
📓 Path-based instructions (1)
packages/**/etc/*.api.md
📄 CodeRabbit inference engine (AGENTS.md)
Always commit API extractor output after running
pnpm turbo api-extractor -- --local(commit updated API report files)
Files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (25)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tswebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/README.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tswebsite/package.jsonwebsite/rspress.config.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tswebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/README.mdwebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonwebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonwebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/README.mdwebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tswebsite/package.jsonwebsite/rspress.config.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Applied to files:
packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.
Applied to files:
packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/README.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonwebsite/rspress.config.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/README.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tswebsite/package.jsonwebsite/rspress.config.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/README.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tswebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.tswebsite/package.json
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.
Applied to files:
website/package.json
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧬 Code graph analysis (1)
website/rspress.config.ts (1)
website/sidebars/api.ts (1)
createAPI(155-192)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (6)
packages/webpack/template-webpack-plugin/package.json (1)
40-40: @lynx-js/template-webpack-plugin is missing a changeset for the @lynx-js/tasm dependency update.Despite modifying the
packages/webpack/template-webpack-plugin/package.jsonfile (changing the @lynx-js/tasm dependency to 0.0.19), no corresponding changeset entry exists. The repository's CI checks require changesets when workspace packages are modified. Additionally, @lynx-js/tasm is an external dependency (not part of the workspace), so it does not need coordination within this PR—only a changeset entry documenting the template-webpack-plugin version update is required.website/package.json (1)
21-25: Dev dependency wiring for docs looks consistentAdding
@lynx-js/lynx-bundle-rslib-configas aworkspace:*devDependency matches the existing pattern for other Rspeedy / Lynx packages and should be sufficient for the docs build pipeline.website/rspress.config.ts (1)
67-69: API docs sidebar wiring for the new package looks correctThe new
createAPI({ name: 'lynx-bundle-rslib-config' })entries are consistent with existing Rspeedy plugin entries and correctly add both EN (basedefault) and ZH (base: 'zh/api') sidebars.Also applies to: 207-210
packages/rspeedy/lynx-bundle-rslib-config/package.json (1)
1-50: Manifest looks solid; just confirm intended Node support rangeThe manifest (exports, deps, files, scripts) looks consistent with other Lynx packages.
engines.node: ">=18"is fine, just make sure this aligns with the runtime support you want for consumers, since the monorepo itself targets Node >=22. Based on learnings, the root doesn’t require Node 18 compatibility, so this broader range is a conscious choice.packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1)
1-6: API Extractor config correctly extends the root settingsThe config simply delegates to the workspace‑level
api-extractor.json, which is the expected pattern here. As long as you’ve run the usualpnpm turbo api-extractor -- --localand committed the generatedetc/lynx-bundle-rslib-config.api.md, this setup is good to go.packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
11-136: External bundle emission pipeline looks correctThe plugin’s flow (collect assets → build
customSections→ callencode→ emit bundle/tasm.jsonand prune originals) is coherent and uses webpack’s compilation hooks appropriately. SnapshottingassetsbeforeemitAssetalso avoids deleting the newly emitted bundle.
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
Show resolved
Hide resolved
85653cd to
d38caf3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
221-236: Verify the type structure: lib-level config is spread at root level.Line 231 spreads
defaultExternalBundleRsbuildConfig(typed asRslibConfig['lib'][0], containingoutput,source,tools) at the rootRslibConfiglevel. This mixes lib-level properties with root-level properties (lib,plugins).According to past review comments, this should be spread inside the lib array item instead:
export function defineExternalBundleRslibConfig( userLibConfig: LibConfig, ): RslibConfig { return { lib: [ { ...defaultExternalBundleLibConfig, + ...defaultExternalBundleRsbuildConfig, ...userLibConfig, }, ], - ...defaultExternalBundleRsbuildConfig, plugins: [ externalBundleRsbuildPlugin(), ], } }Please verify whether the current structure is intentional or if the fix from previous reviews needs to be applied.
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)
1-58: The API Extractor warnings still need to be resolved in the source code.The three categories of warnings in this auto-generated report indicate unresolved issues:
- Lines 12-13, 17-18:
LibConfigis referenced but not re-exported from the package entry point.- Lines 48-49:
MainThreadRuntimeWrapperWebpackPluginis missing a JSDoc release tag (@public).- Line 52:
MainThreadRuntimeWrapperWebpackPluginOptionsis used in the public API but not exported.As per coding guidelines, after fixing these in the source code, regenerate the API report by running
pnpm turbo api-extractor -- --localand commit the updated file.
📜 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 (19)
.changeset/stale-rings-tan.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/rspeedy/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
- packages/webpack/template-webpack-plugin/package.json
- packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
- packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
🧰 Additional context used
📓 Path-based instructions (2)
packages/**/etc/*.api.md
📄 CodeRabbit inference engine (AGENTS.md)
Always commit API extractor output after running
pnpm turbo api-extractor -- --local(commit updated API report files)
Files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
For contributions, generate and commit a Changeset describing your changes
Files:
.changeset/stale-rings-tan.md
🧠 Learnings (29)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdwebsite/rspress.config.ts.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md.changeset/stale-rings-tan.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/stale-rings-tan.md
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts.changeset/stale-rings-tan.md
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdwebsite/rspress.config.tspackages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdwebsite/rspress.config.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.
Applied to files:
website/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts.changeset/stale-rings-tan.md
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdwebsite/rspress.config.tspackages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧬 Code graph analysis (1)
website/rspress.config.ts (1)
website/sidebars/api.ts (1)
createAPI(155-192)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (10)
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1)
1-10: LGTM!The Vitest workspace configuration is correctly set up with an appropriate test project name matching the package structure.
website/package.json (1)
24-24: LGTM!The new workspace dependency is correctly added and follows the existing pattern for internal package references.
.changeset/stale-rings-tan.md (1)
1-22: LGTM!The changeset correctly uses the exact package name from package.json and provides a clear usage example. The patch version bump is appropriate for this new package introduction.
website/rspress.config.ts (2)
67-69: LGTM!The API documentation entry for the new package is correctly added to the Rspeedy plugins section, following the existing pattern.
207-210: LGTM!The Chinese API documentation entry mirrors the English version correctly with the appropriate base path.
packages/rspeedy/lynx-bundle-rslib-config/package.json (1)
1-50: LGTM!The package.json is well-structured with appropriate dependencies, exports configuration, and Node.js version constraint. The workspace dependencies and versioning follow monorepo conventions correctly.
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (3)
151-220: LGTM!The JSDoc documentation is comprehensive with three clear examples demonstrating different usage patterns (background-only, main-thread-only, and dual-layer bundles). The import paths are correct.
238-259: LGTM!The plugin implementation correctly uses dynamic import for @lynx-js/tasm and properly integrates the ExternalBundleWebpackPlugin with the bundler chain.
68-134: LGTM!The bundler chain logic correctly handles different entry types (string, array, object) and appropriately creates layered entries for background and main-thread execution contexts. The entry naming convention is clear and consistent.
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
1-48: LGTM!The plugin correctly uses webpack's BannerPlugin to wrap modules in an IIFE with proper module/exports scaffolding. The implementation is clean and the IIFE pattern is confirmed as necessary for lynx-core integration (per past review discussion).
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Outdated
Show resolved
Hide resolved
1047cf8 to
ac65c1a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
221-235: Verify root-level spread ofdefaultExternalBundleRsbuildConfigmatches intended RslibConfig shapeHere
defaultExternalBundleRsbuildConfigis typed asRslibConfig['lib'][0]but is spread at the root level of the returnedRslibConfig. Ifoutput,source, andtools.bundlerChainare meant as root-level rsbuild options (not per-lib options), the naming/type alias is slightly misleading; if they are per-lib, they probably belong inside thelibitem instead.Given the earlier discussion on this point, please double-check against
@rslib/core’s config shape to be sure the properties end up at the intended level and won’t surprise users composing configs.packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)
12-23: ResolveLibConfigunresolved-link warnings in API reportAPI Extractor still reports
ae-unresolved-linkfor{@link LibConfig}ondefaultExternalBundleLibConfiganddefaultExternalBundleRsbuildConfig, meaning the link target isn’t part of this package’s public API.Consider either:
- Re-exporting
LibConfigfrom your entry point, or- Adjusting/removing the
{@link LibConfig}tags (e.g., fully qualifying the external type or turning the text into a plain description),then rerun
pnpm turbo api-extractor -- --localand commit the updated.api.mdso the warnings disappear.
🧹 Nitpick comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
107-136: Consider buildingcustomSectionswithout repeated object spreads
#encodecurrently usesreducewith{ ...prev, [cur.name.replace('.js', '')]: { content: ... } }, which recreates the entirecustomSectionsobject on each iteration. For larger bundles this can add unnecessary overhead.You could build the map incrementally instead:
- const customSections = assets - .filter(({ name }) => name.endsWith('.js')) - .reduce<Record<string, { content: string }>>((prev, cur) => ({ - ...prev, - [cur.name.replace('.js', '')]: { - content: cur.source.source().toString(), - }, - }), {}) + const customSections: Record<string, { content: string }> = {} + for (const { name, source } of assets) { + if (!name.endsWith('.js')) continue + customSections[name.replace('.js', '')] = { + content: source.source().toString(), + } + }Functionality stays the same with slightly better performance characteristics.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (19)
.changeset/stale-rings-tan.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (12)
- website/package.json
- packages/rspeedy/lynx-bundle-rslib-config/package.json
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
- website/rspress.config.ts
- packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/webpack/template-webpack-plugin/package.json
- packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
- packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/README.md
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
For contributions, generate and commit a Changeset describing your changes
Files:
.changeset/stale-rings-tan.md
packages/**/etc/*.api.md
📄 CodeRabbit inference engine (AGENTS.md)
Always commit API extractor output after running
pnpm turbo api-extractor -- --local(commit updated API report files)
Files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (27)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/tsconfig.json
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/utils.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/utils.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
packages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.
Applied to files:
packages/rspeedy/tsconfig.json
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧬 Code graph analysis (2)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
ExternalBundleWebpackPluginOptions(56-56)ExternalBundleWebpackPlugin(55-55)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
MainThreadRuntimeWrapperWebpackPluginOptions(58-58)MainThreadRuntimeWrapperWebpackPlugin(57-57)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (7)
.changeset/stale-rings-tan.md (1)
2-2: Verify version bump type for new package introduction.The changeset uses
patchfor a new package initialization. Since this PR is categorized asfeat:(introducing a brand new package), consider usingminorinstead, which aligns with the monorepo's pre-1.0 semantic versioning convention where new features/packages are tracked with minor version bumps.packages/rspeedy/tsconfig.json (1)
12-12: LGTM!The new reference follows the existing pattern perfectly—consistent syntax, formatting, and appropriate placement within the packages section. The entry integrates the new
lynx-bundle-rslib-configpackage into the composite TypeScript build correctly.packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
7-24: decodeTemplate helper looks good for test usageThe platform switch, dynamic import of
@lynx-js/tasm, and binary read/forward into the decoder are all reasonable here; given this is test-only, the direct cast toDecodeTemplateResultis acceptable and keeps the helper simple.packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (2)
47-149: Layered entry transformation and runtime wrapper wiring look coherentThe
bundlerChaincorrectly:
- Clones & clears existing entries.
- Generates background/main-thread variants for string/array entries and object entries (with or without explicit
layer).- Tracks entry names and uses
escapeRegexwhen buildingRegExptests for the runtime wrapper plugins, avoiding invalid patterns from entry names with metacharacters.This should give predictable
__main-threadand background entries while safely targeting only the generated.jsassets for wrapping.
238-261: Good encapsulation of rsbuild plugin and regex escaping helper
externalBundleRsbuildPluginneatly hides theExternalBundleWebpackPluginwiring (includinggetEncodeMode()usage and${libName}.lynx.bundlenaming), and the standaloneescapeRegexhelper is a clean way to centralize safe regex construction for entry names.This keeps the public API focused on
defineExternalBundleRslibConfig/LAYERSwhile keeping bundler details internal.packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
11-47: Main-thread runtime wrapper plugin implementation looks solidThe two
BannerPlugininstances correctly wrap matching JS assets in an IIFE, initializemodule/exports, and returnmodule.exports, with an overridabletestand proper@publicannotations for API extraction. This aligns well with the described Lynx main-thread runtime requirements.packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
55-105: Compilation hook and bundle emission behavior are appropriateHooking at
thisCompilation→processAssetswithPROCESS_ASSETS_STAGE_OPTIMIZE_HASHis a good spot to aggregate JS assets, run the encoder, and then emit a single${bundleFileName}asset. CapturingassetsbeforeemitAssetand then deleting those entries ensures only the new external bundle (and optionaltasm.jsonin DEBUG) remain, which matches the intended “single encoded bundle” output model.
ac65c1a to
077e3c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1)
5-6: Remove invalid trailing comma in JSON.The trailing comma after
"noEmit": true,is invalid JSON syntax and will cause parsing to fail.Apply this diff to fix the syntax error:
"compilerOptions": { "rootDir": ".", - "noEmit": true, + "noEmit": true },
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (19)
.changeset/stale-rings-tan.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- .changeset/stale-rings-tan.md
🚧 Files skipped from review as they are similar to previous changes (13)
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- website/rspress.config.ts
- packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
- website/package.json
- packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
- packages/rspeedy/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
- packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
- packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- packages/webpack/template-webpack-plugin/package.json
🧰 Additional context used
🧠 Learnings (25)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.json
🧬 Code graph analysis (2)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (6)
LAYERS(52-52)defaultExternalBundleLibConfig(50-50)defaultExternalBundleRsbuildConfig(51-51)MainThreadRuntimeWrapperWebpackPlugin(57-57)defineExternalBundleRslibConfig(49-49)ExternalBundleWebpackPlugin(55-55)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
MainThreadRuntimeWrapperWebpackPlugin(26-48)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
ExternalBundleWebpackPlugin(52-137)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
MainThreadRuntimeWrapperWebpackPluginOptions(58-58)MainThreadRuntimeWrapperWebpackPlugin(57-57)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
compiler(81-105)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (6)
packages/rspeedy/lynx-bundle-rslib-config/package.json (2)
47-49: Verify the Node.js engine requirement.The package specifies
"node": ">=18", which differs from the root project's requirement of^22 || ^24. Based on learnings, thelynx-js/devtool-mcp-serverpackage has a similar divergence for Node.js v18 compatibility. Please confirm whether this package intentionally supports Node.js >=18 for broader external consumer compatibility, or if it should align with the root project's Node.js version requirements.
38-41: Update @lynx-js/tasm to an existing version.The dependency
@lynx-js/tasmis pinned to version0.0.19, but this version does not exist on npm; the latest published version is 0.0.17. Update to0.0.17or another valid published version.⛔ Skipped due to learnings
Learnt from: colinaaa Repo: lynx-family/lynx-stack PR: 1454 File: pnpm-workspace.yaml:46-46 Timestamp: 2025-08-07T04:00:59.645Z Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.Learnt from: colinaaa Repo: lynx-family/lynx-stack PR: 1917 File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8 Timestamp: 2025-11-06T01:19:23.670Z Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.Learnt from: colinaaa Repo: lynx-family/lynx-stack PR: 1523 File: vitest.config.ts:52-72 Timestamp: 2025-08-13T11:36:12.075Z Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.Learnt from: colinaaa Repo: lynx-family/lynx-stack PR: 1566 File: package.json:53-53 Timestamp: 2025-08-20T04:56:36.011Z Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.Learnt from: colinaaa Repo: lynx-family/lynx-stack PR: 1558 File: .changeset/solid-squids-fall.md:2-2 Timestamp: 2025-08-19T11:25:36.127Z Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).Learnt from: upupming Repo: lynx-family/lynx-stack PR: 1305 File: packages/react/testing-library/src/plugins/vitest.ts:4-6 Timestamp: 2025-08-11T05:59:28.530Z Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.Learnt from: gaoachao Repo: lynx-family/lynx-stack PR: 1736 File: .changeset/spotty-experts-smoke.md:1-3 Timestamp: 2025-09-12T09:43:04.847Z Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.Learnt from: upupming Repo: lynx-family/lynx-stack PR: 1616 File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3 Timestamp: 2025-08-27T12:42:01.095Z Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.Learnt from: upupming Repo: lynx-family/lynx-stack PR: 1370 File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27 Timestamp: 2025-08-21T08:46:54.494Z Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.Learnt from: colinaaa Repo: lynx-family/lynx-stack PR: 1447 File: pnpm-workspace.yaml:20-22 Timestamp: 2025-08-06T08:25:15.392Z Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.Learnt from: colinaaa Repo: lynx-family/lynx-stack PR: 1523 File: vitest.config.ts:5-6 Timestamp: 2025-08-13T11:46:43.737Z Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
26-48: LGTM!The plugin correctly wraps JavaScript modules with an IIFE pattern that provides
module.exportsfunctionality. The wrapper structure is necessary for lynx-core compatibility as confirmed in past review discussions.packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
5-58: LGTM!The public API surface is well-documented with clear usage examples. The exports are properly structured, and the documentation explains the different usage patterns for main-thread and background contexts.
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (2)
47-149: LGTM!The bundlerChain logic correctly handles entry transformation for dual-layer (main-thread and background) bundles. The implementation properly:
- Preserves explicit layer specifications
- Creates layered variants for unspecified entries
- Escapes entry names via
escapeRegexbefore regex construction (line 261)- Registers wrapper plugins with appropriate test patterns
The minify configuration correctly preserves the IIFE wrapper needed for lynx-core module loading.
Note: The static analysis warnings on lines 138 and 143 about ReDoS are false positives. The
escapeRegexfunction (line 261) properly escapes all regex metacharacters before interpolation, making the regex construction safe.
238-259: LGTM!The
externalBundleRsbuildPlugincorrectly:
- Dynamically imports
@lynx-js/tasmfor code splitting- Extracts the library name from the environment context
- Configures
ExternalBundleWebpackPluginwith appropriate bundle filename and encode function
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Show resolved
Hide resolved
upupming
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM!
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
Outdated
Show resolved
Hide resolved
077e3c9 to
1254f06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)
12-20: API Extractor warnings indicate incomplete public API surface.The
ae-unresolved-linkwarnings on lines 12-13 and 17-18 indicate thatLibConfigis referenced in JSDoc but not exported from this package. This was already flagged in a previous review.As per coding guidelines, after fixing the source code to re-export
LibConfigfrom@rslib/core(or adjust type signatures), regenerate and commit the API report by runningpnpm turbo api-extractor -- --local.packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
221-236: Type mismatch:defaultExternalBundleRsbuildConfigspread at incorrect level.Line 47 declares
defaultExternalBundleRsbuildConfigasRslibConfig['lib'][0](a lib-level config), but line 231 spreads it at the root level of the returnedRslibConfig. While Rslib does supportoutput,source, andtoolsat both levels, this creates a type inconsistency.Consider either:
- Changing the type annotation to
Partial<RslibConfig>, or- Moving the spread inside the
lib[0]object and adjusting the merge logic accordingly
🧹 Nitpick comments (3)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)
42-130: Consider adding cleanup between integration tests to ensure isolation.The integration tests all write to subdirectories under
fixtures/utils-lib/distwith different bundle IDs. While the distinct IDs prevent direct conflicts, leftover artifacts from previous test runs could affect assertions. Consider adding abeforeEachorafterEachhook to clean up the dist directory.describe('should build external bundle', () => { const fixtureDir = path.join(__dirname, './fixtures/utils-lib') + + afterEach(() => { + const distPath = path.join(fixtureDir, 'dist') + if (fs.existsSync(distPath)) { + fs.rmSync(distPath, { recursive: true }) + } + }) it('should build both main-thread and background code into external bundle', async () => {packages/rspeedy/lynx-bundle-rslib-config/package.json (1)
42-46: Consider declaring@rslib/coreas a peer dependency.The package's public API (e.g.,
defineExternalBundleRslibConfig) returnsRslibConfigand acceptsLibConfigfrom@rslib/core. Consumers will need@rslib/coreinstalled to use this package effectively. Adding it as apeerDependencymakes this requirement explicit:"devDependencies": { "@rslib/core": "^0.15.0", "vitest": "^3.2.4", "webpack": "^5.102.0" + }, + "peerDependencies": { + "@rslib/core": "^0.15.0" } }packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
117-123: Consider making compiler options configurable for future flexibility.The
compilerOptionsare currently hardcoded. While this works for the initial release, you may want to allow overriding some options (e.g.,targetSdkVersion) via the plugin options for forward compatibility.export interface ExternalBundleWebpackPluginOptions { bundleFileName: string encode: (opts: unknown) => Promise<{ buffer: Buffer }> + /** + * Override default compiler options for encoding. + */ + compilerOptions?: Partial<{ + enableFiberArch: boolean + useLepusNG: boolean + enableReuseContext: boolean + bundleModuleMode: string + targetSdkVersion: string + }> }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (20)
.changeset/sour-ghosts-tease.md(1 hunks).changeset/stale-rings-tan.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- website/package.json
- packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
- packages/webpack/template-webpack-plugin/package.json
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
- packages/rspeedy/tsconfig.json
- website/rspress.config.ts
- .changeset/stale-rings-tan.md
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
For contributions, generate and commit a Changeset describing your changes
Files:
.changeset/sour-ghosts-tease.md
packages/**/etc/*.api.md
📄 CodeRabbit inference engine (AGENTS.md)
Always commit API extractor output after running
pnpm turbo api-extractor -- --local(commit updated API report files)
Files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (28)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Applied to files:
.changeset/sour-ghosts-tease.md
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧬 Code graph analysis (2)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
MainThreadRuntimeWrapperWebpackPluginOptions(58-58)MainThreadRuntimeWrapperWebpackPlugin(57-57)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (3)
packages/rspeedy/core/src/index.ts (2)
Rspack(71-71)RsbuildPlugin(67-67)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
MainThreadRuntimeWrapperWebpackPlugin(26-48)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
ExternalBundleWebpackPlugin(52-137)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: build / Build (Ubuntu)
- GitHub Check: build / Build (Windows)
- GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (8)
.changeset/sour-ghosts-tease.md (1)
1-5: Unfortunately, I'm unable to clone the repository to verify the changeset directly. However, based on the learnings from this repository, I can provide important context for your review:The learnings indicate that private packages (marked with
"private": truein package.json) do not require changeset entries, even when their public APIs change or they are newly initialized, since they are not published externally.To complete the verification, I need you to confirm one key detail:
Is
@lynx-js/lynx-bundle-rslib-configmarked as"private": truein its package.json?
- If YES (private package): The changeset is likely correct—private packages don't require entries per repository conventions shown in learnings.
- If NO (public package): The changeset should include an entry for the new package (e.g.,
"@lynx-js/lynx-bundle-rslib-config": "minor"for a new public package).Additionally, if you can provide the content of
packages/[path-to-new-package]/package.jsonor confirm its private status, I can rewrite the review comment accurately.packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1)
1-6: LGTM!Standard API Extractor configuration extending the base config. This follows the repository's established pattern.
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)
159-177: LGTM on debug mode tests.The environment variable stubbing pattern with
vi.stubEnvandvi.unstubAllEnvsis correct and ensures proper test isolation.packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
1-58: LGTM!The package entry point is well-documented with clear usage examples and properly re-exports all public API entities. The
@packageDocumentationJSDoc provides helpful quick-start instructions.packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
26-48: LGTM!The plugin correctly wraps main-thread bundles with an IIFE that provides CommonJS module scaffolding. The
@publicJSDoc tags are properly applied for API Extractor.packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
136-146: Regex escaping is correctly implemented.The
escapeRegexhelper on line 261 properly escapes all regex metacharacters before constructing theRegExp. The static analysis warning about ReDoS is a false positive because the escaped input cannot form a malicious pattern.packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (2)
38-45: LGTM on debug detection logic.The
isDebug()function correctly parses theDEBUGenvironment variable and checks for relevant values case-insensitively.
55-79: LGTM on webpack hook integration.The plugin correctly taps into
thisCompilationand usesPROCESS_ASSETS_STAGE_OPTIMIZE_HASHto run after minification, ensuring the final bundle content is captured.
1254f06 to
a93fee8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1)
5-5: Remove invalid trailing comma in JSON.Line 5 contains a trailing comma after
"noEmit": true,which is invalid JSON syntax. JSON does not support trailing commas, and this will cause the configuration file to fail parsing.Apply this diff to fix the syntax error:
"compilerOptions": { "rootDir": ".", - "noEmit": true, + "noEmit": true },
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (20)
.changeset/sour-ghosts-tease.md(1 hunks).changeset/stale-rings-tan.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (12)
- packages/webpack/template-webpack-plugin/package.json
- .changeset/sour-ghosts-tease.md
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
- packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
- packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
- packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
- packages/rspeedy/lynx-bundle-rslib-config/package.json
- packages/rspeedy/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
For contributions, generate and commit a Changeset describing your changes
Files:
.changeset/stale-rings-tan.md
🧠 Learnings (31)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
website/rspress.config.tswebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
website/rspress.config.tspackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
website/rspress.config.tswebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
website/rspress.config.tswebsite/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json.changeset/stale-rings-tan.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json.changeset/stale-rings-tan.md
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/tsconfig.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.
Applied to files:
website/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
website/package.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes
Applied to files:
.changeset/stale-rings-tan.md
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
.changeset/stale-rings-tan.mdpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧬 Code graph analysis (1)
website/rspress.config.ts (1)
website/sidebars/api.ts (1)
createAPI(155-192)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (8)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
26-48: LGTM!The IIFE wrapper implementation correctly provides the
module.exportsscaffold required by lynx-core. The two BannerPlugin instances appropriately wrap the bundle with initialization code (header) and the return statement (footer).website/package.json (1)
24-24: LGTM!The workspace dependency addition is consistent with the monorepo pattern and enables the website to document the new package's API.
.changeset/stale-rings-tan.md (1)
1-22: LGTM!The changeset properly describes the new package with a clear example. The usage snippet accurately reflects the public API defined in the package.
Based on learnings, this changeset follows the repository's conventions for documenting new package introductions.
website/rspress.config.ts (1)
67-69: LGTM!The API documentation entries are properly configured for both English and Chinese locales, following the established pattern used by other Rspeedy plugins in the sidebar configuration.
Also applies to: 207-210
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
1-58: LGTM!The package documentation is comprehensive and the public API surface is well-organized. The re-exports clearly expose the configuration utilities and webpack plugins for external consumption.
Based on past review comments, the
__BACKGROUND__conditional usage in the documentation (lines 39-43) reflects the current Lynx engine limitation and will be addressed in future Lynx RFC updates.packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
17-149: LGTM!The implementation correctly handles entry layering for both MAIN_THREAD and BACKGROUND contexts:
- The bundlerChain logic properly transforms string, array, and object entries into layered variants
- The escapeRegex utility safely handles entry names containing regex metacharacters before constructing test patterns (lines 138-139, 143-144)
- The externalBundleRsbuildPlugin correctly integrates with the build system and imports the tasm encode function
Note: The static analysis warnings about ReDoS on lines 138 and 143 are false positives—entry names are escaped via
escapeRegexbefore being used in RegExp construction.Also applies to: 221-259, 261-261
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (2)
11-36: LGTM!The plugin interface is well-documented with clear examples, and the debug mode detection correctly checks for common debug environment variable patterns used in the ecosystem.
Also applies to: 38-45
52-134: LGTM!The plugin implementation is well-structured:
- Hooks into the appropriate compilation stage (PROCESS_ASSETS_STAGE_OPTIMIZE_HASH)
- Properly collects and encodes JS assets into custom sections
- Conditionally emits debug artifacts (
tasm.json) whenDEBUGenv is set- Cleans up intermediate assets in production mode
Based on past review comments, the
targetSdkVersion: '3.4'requirement (line 120) andappType: 'DynamicComponent'(line 126) are intentional design choices for the external bundle format. CSS handling in custom sections is not currently supported by the Lynx engine and is acknowledged as a future enhancement.
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Outdated
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Outdated
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Outdated
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Show resolved
Hide resolved
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
Outdated
Show resolved
Hide resolved
a93fee8 to
eaec76a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
113-121: Consider usingreplaceAllor a regex for robust.jsremoval.Line 118 uses
replace('.js', '')which only removes the first occurrence. While unlikely, a filename likefoo.js.bundle.jswould becomefoo.bundle.jsinstead of the intendedfoo.js.bundle.Apply this diff for safer replacement:
const customSections = assets .filter(({ name }) => name.endsWith('.js')) .reduce<Record<string, { content: string }>>((prev, cur) => ({ ...prev, - [cur.name.replace('.js', '')]: { + [cur.name.replace(/\.js$/, '')]: { content: cur.source.source().toString(), }, }), {})
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (20)
.changeset/sour-ghosts-tease.md(1 hunks).changeset/stale-rings-tan.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/webpack/template-webpack-plugin/package.json
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
- .changeset/stale-rings-tan.md
- website/package.json
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- packages/rspeedy/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
- packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
- packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
- website/rspress.config.ts
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
For contributions, generate and commit a Changeset describing your changes
Files:
.changeset/sour-ghosts-tease.md
packages/**/etc/*.api.md
📄 CodeRabbit inference engine (AGENTS.md)
Always commit API extractor output after running
pnpm turbo api-extractor -- --local(commit updated API report files)
Files:
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (25)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.jsonpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
.changeset/sour-ghosts-tease.mdpackages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Applied to files:
.changeset/sour-ghosts-tease.md
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
🧬 Code graph analysis (1)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
ExternalBundleWebpackPluginOptions(55-55)ExternalBundleWebpackPlugin(54-54)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
[warning] 240-240: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 245-245: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (13)
.changeset/sour-ghosts-tease.md (1)
1-5: Unable to verify changeset completeness—repository access unavailable.I attempted to verify the changeset against the repository structure, but the sandbox environment cannot clone the repository to access package.json files and related configurations.
The verification points that cannot be confirmed:
- Whether the package name
@lynx-js/template-webpack-pluginmatches the exact scoped name in itspackage.json#name- Whether a new
@lynx-js/lynx-bundle-rslib-configpackage exists and requires its own changeset entry (if public)- Whether the
@lynx-js/tasmdependency actually exists in template-webpack-plugin and was upgraded from the claimed version- Whether all modified
src/**files have corresponding changeset entriesBased on learnings from the repository, changesets must use exact scoped package names and all public package changes require entries. Without repository access, these cannot be verified.
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1)
1-6: LGTM!The API Extractor configuration correctly extends the shared base configuration, following the repository's established pattern for public API surface management.
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (3)
6-42: LGTM!The
ExternalBundleWebpackPluginOptionsinterface is well-documented with clear JSDoc examples. The optionaltargetSdkVersionwith a sensible default of'3.4'aligns with thelynx.fetchBundleSDK requirement noted in the past review comments.
44-51: LGTM!The
isDebug()helper provides a reasonable mechanism for debug mode detection, supporting multiple debug identifiers (rsbuild,rspeedy,*) via the standardDEBUGenvironment variable.
87-111: LGTM!The
#generateExternalBundlemethod correctly:
- Emits the encoded bundle with the configured filename
- Outputs debug information (
tasm.json) only whenDEBUGis set- Cleans up intermediate
.jsassets in production modepackages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
1-57: LGTM!The package entry point is well-structured with:
- Comprehensive
@packageDocumentationwith step-by-step usage examples- Proper separation of value exports and type-only exports
- Clear re-exports from internal modules establishing the public API surface
The documentation correctly reflects the current
__BACKGROUND__conditional requirement for loading scripts in different threads, as discussed in past review comments.packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (5)
13-35: LGTM!The
EncodeOptionsinterface andLAYERSconstant are well-documented and provide clear, type-safe configuration options for external bundle layers.
37-76: LGTM!The
defaultExternalBundleLibConfigprovides sensible defaults:
- CJS format with ES2015 syntax for Lynx compatibility
- Disabled auto-extension and auto-external for explicit control
- Proper minify options preserving IIFE wrappers required by Lynx module loader
- Includes
node_modulesin source transformationThe
negate_iife: falseandside_effects: falsecompression options are correctly documented as required for the Lynx module wrapper.
148-165: LGTM!The
defineExternalBundleRslibConfigfunction correctly:
- Merges user config with defaults using
rsbuild.mergeRsbuildConfig- Attaches the entry and bundle generation plugins
- Passes through
encodeOptions.targetSdkVersionto the bundle plugin
236-249: Static analysis false positive - regex is safely escaped.The static analysis warnings on lines 240 and 245 flag
RegExpconstruction from variable input. However, theescapeRegex()helper (line 279) properly escapes all regex metacharacters before interpolation, making these patterns safe literal matches. The resulting pattern${escapeRegex(name)}\.js$will only match the exact filename.This was already addressed in a past review where unescaped regex construction was flagged and fixed.
253-279: LGTM!The
externalBundleRsbuildPlugincorrectly:
- Dynamically imports
@lynx-js/tasmfor the encode function- Configures
ExternalBundleWebpackPluginwith the library name as bundle filename- Passes through the optional
targetSdkVersionThe
escapeRegexhelper at line 279 is a standard, correct implementation for escaping regex metacharacters.packages/rspeedy/lynx-bundle-rslib-config/package.json (1)
42-46: Vitest version 3.2.4 is valid and stable.The review comment's concern about vitest ^3.2.4 being unverified is unfounded. Vitest version 3.2.4 was published on June 17, 2025, and is a stable release. As of November 2025, this version has been available for approximately five months and is suitable for use.
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)
12-13: The task has been completed. My final rewritten review comment was provided in the previous response with the `` tag. Due to persistent repository access failures, manual verification is required to confirm whether theLibConfigexport issue exists in the source code.
1f4ee2b to
c17dc62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (20)
.changeset/sour-ghosts-tease.md(1 hunks).changeset/stale-rings-tan.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks)packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks)packages/rspeedy/tsconfig.json(1 hunks)packages/webpack/template-webpack-plugin/package.json(1 hunks)website/package.json(1 hunks)website/rspress.config.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (14)
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
- website/rspress.config.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
- packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
- packages/rspeedy/tsconfig.json
- packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
- packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
- .changeset/sour-ghosts-tease.md
- packages/rspeedy/lynx-bundle-rslib-config/package.json
- .changeset/stale-rings-tan.md
🧰 Additional context used
🧠 Learnings (32)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
website/package.jsonpackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Applied to files:
website/package.jsonpackages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Applied to files:
website/package.jsonpackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
website/package.jsonpackages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Applied to files:
website/package.jsonpackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Applied to files:
website/package.jsonpackages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
website/package.jsonpackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.
Applied to files:
website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.
Applied to files:
website/package.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.
Applied to files:
website/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
website/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Applied to files:
packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes
Applied to files:
packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/webpack/template-webpack-plugin/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.
Applied to files:
packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
🧬 Code graph analysis (1)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (4)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (6)
EncodeOptions(53-53)LAYERS(51-51)defaultExternalBundleLibConfig(50-50)defineExternalBundleRslibConfig(49-49)MainThreadRuntimeWrapperWebpackPlugin(56-56)ExternalBundleWebpackPlugin(54-54)packages/rspeedy/core/src/index.ts (2)
RsbuildPlugin(67-67)Rspack(71-71)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
MainThreadRuntimeWrapperWebpackPlugin(26-48)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
ExternalBundleWebpackPlugin(58-141)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
[warning] 240-240: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 245-245: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (17)
packages/webpack/template-webpack-plugin/package.json (1)
40-40: I attempted to verify the changeset entry, but encountered a repository access issue. However, I can still address the review comment based on the context available.The original review comment contains a valid concern that was already flagged by a past reviewer: a changeset entry should accompany the dependency upgrade of
@lynx-js/tasmfrom 0.0.18 to 0.0.20 in this public package.Based on the repository learnings provided:
- Public packages in lynx-stack require changeset entries for meaningful changes
- The past reviewer already identified this as needing a changeset
- Dependency updates in public packages should be documented in changesets
Add a changeset entry for the
@lynx-js/tasmdependency upgrade.The dependency update from
@lynx-js/tasm0.0.18 to 0.0.20 in this public package requires a corresponding changeset entry. Per the repository's convention and the past review feedback, please verify or create a changeset file documenting this change using the exact package name@lynx-js/template-webpack-plugin.website/package.json (1)
24-24: LGTM!The addition of the new workspace dependency follows the established monorepo pattern and correctly references the new package being introduced in this PR.
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (2)
11-20: LGTM!The options interface is well-typed and documented, correctly referencing the BannerPlugin's test option type.
26-48: LGTM!The plugin implementation correctly wraps the bundle with an IIFE that returns
module.exports. The two-stage BannerPlugin approach (header + footer) properly constructs the wrapper, and the pattern is confirmed necessary for lynx-core compatibility per past review discussions.packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
5-47: LGTM!The package documentation is comprehensive and includes clear examples for installation and usage. The
__BACKGROUND__conditional loading pattern is a Lynx Engine requirement for differentiating main-thread and background-thread bundles, as confirmed in past review discussions.
48-57: LGTM!The re-export structure is clean and follows TypeScript best practices by separating type exports from value exports. All exports align with the public API surface documented in the package.
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (6)
18-25: LGTM!The
EncodeOptionsinterface is well-documented with a clear default value that aligns with the minimum Lynx SDK version required forfetchBundlesupport.
32-35: LGTM!The
LAYERSconstant provides type-safe layer names with properas constassertion for literal type inference.
42-76: LGTM!The default configuration is well-suited for Lynx external bundles with appropriate settings:
- Preserves IIFE wrappers needed for module loading (
negate_iife: false)- Disables unsupported shims for Lynx compatibility
- Includes node_modules transformation to ES2015 target
- Correctly handles both dependencies and peerDependencies (per past review feedback)
148-165: LGTM!The main configuration function correctly merges user config with defaults and registers the necessary plugins for entry layering and bundle generation. The comprehensive JSDoc examples above provide clear usage guidance for all three scenarios (background-only, main-thread-only, and dual-thread bundles).
167-251: LGTM!The entry rewriting logic correctly handles all three entry scenarios:
- String/array entries → dual-layered (main-thread + background)
- Object entries with explicit layer → single layer
- Object entries without layer → dual-layered
The
escapeRegexhelper (line 279) properly sanitizes entry names before regex construction, so the static analysis warnings about RegExp from variable input are false positives.Also applies to: 279-279
253-277: LGTM!The bundle generation plugin correctly integrates with the tasm encoder via dynamic import and properly configures the
ExternalBundleWebpackPluginwith the bundle filename and encoding options.packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (5)
11-42: LGTM!The options interface is well-documented with clear examples for each field. The encode signature correctly matches the tasm API contract.
44-51: LGTM!The debug detection helper correctly checks for relevant keywords in the
DEBUGenvironment variable with case-insensitive matching.
61-85: LGTM!The plugin correctly hooks into the
PROCESS_ASSETS_STAGE_OPTIMIZE_HASHstage, which ensures the bundle is generated after all optimizations (minification, source maps) are complete.
87-111: LGTM!The bundle generation logic appropriately handles debug vs. production modes:
- Debug: preserves original assets and emits
tasm.jsonfor inspection- Production: cleans up original assets, leaving only the encoded bundle
123-140: LGTM!The encoding configuration correctly sets up:
enableFiberArch: truefor modern Lynx architecturetargetSdkVersionwith appropriate default ('3.4'is minimum forfetchBundlesupport)appType: 'DynamicComponent'for external bundle context
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
Show resolved
Hide resolved
c17dc62 to
5b4bf78
Compare
5b4bf78 to
215c7ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
167-235: Clarify behavior for non‑Lynxlayervalues.In
externalBundleEntryRsbuildPlugin, any entry withvalue.layerother thanLAYERS.MAIN_THREADorLAYERS.BACKGROUND(including arbitrary strings) falls into the “not specify layer” branch and is duplicated into both layers with renamed entries.If users ever rely on other webpack/rsbuild layer names (e.g. for SSR or other pipelines), this will silently change semantics. If the intent is “only our two
LAYERSvalues are supported”, consider either:
- Treating only
undefinedas “no layer specified”, or- Narrowing the
layertype aroundLAYERSfor configs using this helper, and documenting that other layer values aren’t supported.Otherwise, a brief doc note about this behavior would help avoid surprises.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
-
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (20)
-
.changeset/sour-ghosts-tease.md(1 hunks) -
.changeset/stale-rings-tan.md(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/README.md(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/package.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json(1 hunks) -
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts(1 hunks) -
packages/rspeedy/tsconfig.json(1 hunks) -
packages/webpack/template-webpack-plugin/package.json(1 hunks) -
website/package.json(1 hunks) -
website/rspress.config.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (14)
- packages/webpack/template-webpack-plugin/package.json
- packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
- website/package.json
- packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
- packages/rspeedy/lynx-bundle-rslib-config/package.json
- packages/rspeedy/lynx-bundle-rslib-config/README.md
- .changeset/sour-ghosts-tease.md
- packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
- website/rspress.config.ts
- packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
- packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
- packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
- .changeset/stale-rings-tan.md
🧰 Additional context used
🧠 Learnings (17)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/test/utils.tspackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/tsconfig.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/lynx-bundle-rslib-config/test/utils.tspackages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.tspackages/rspeedy/lynx-bundle-rslib-config/test/utils.tspackages/rspeedy/tsconfig.json
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Applied to files:
packages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Applied to files:
packages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Applied to files:
packages/rspeedy/tsconfig.json
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Applied to files:
packages/rspeedy/tsconfig.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.
Applied to files:
packages/rspeedy/tsconfig.json
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧬 Code graph analysis (1)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (4)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (6)
EncodeOptions(53-53)LAYERS(51-51)defaultExternalBundleLibConfig(50-50)defineExternalBundleRslibConfig(49-49)MainThreadRuntimeWrapperWebpackPlugin(56-56)ExternalBundleWebpackPlugin(54-54)packages/rspeedy/core/src/index.ts (2)
RsbuildPlugin(67-67)Rspack(71-71)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
MainThreadRuntimeWrapperWebpackPlugin(26-48)packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
ExternalBundleWebpackPlugin(58-141)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
[warning] 240-240: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
[warning] 245-245: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html
(regexp-from-variable)
🔇 Additional comments (12)
packages/rspeedy/tsconfig.json (1)
12-12: Reference added correctly to TypeScript composite configuration.The new package reference follows the established pattern in the workspace references array, with proper path syntax and placement within the
packages-start/packages-endboundaries.Please verify that the referenced file
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.jsonexists in the repository.packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
5-25: decodeTemplate helper is clear and appropriate for test usageThe OS-based decoder selection plus a simple file read and narrow DecodeTemplateResult cast makes this helper straightforward and focused on the fields tests actually assert on. No issues from my side.
packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1)
1-5: Fixture exports look good and intentionaladd is a straightforward helper, and using
// @ts-expect-erroraroundglobalThis?.abcis reasonable in a fixture when you explicitly want to exercise an undeclared global without tightening typings.packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1)
1-10: Vitest project config is minimal and consistentUsing
defineProjectwith a scoped, descriptivetest.nameand exporting it as the default config is consistent with typical per-package setups; nothing problematic here.packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (4)
42-76: Default lib config is coherent for Lynx external bundles.The
defaultExternalBundleLibConfigchoices (CJS + ES2015, disabledautoExternal,import.meta.urlshim off, and the targeted Tersercompressflags to keep the wrapper IIFE and returns) look consistent with the described Lynx loader/runtime requirements, andsource.include: [/node_modules/]matches the intent to transpile dependencies. No issues from my side here.
78-165: Public API and factory shape are clear and consistent.The JSDoc for
defineExternalBundleRslibConfig,EncodeOptions, andLAYERSmatches the implementation: examples use./src/utils.ts, the generated entry names (utils/utils__main-thread) align with the later regex tests, and theencodeOptionsdefault/forwarding intoexternalBundleRsbuildPluginmatches thetargetSdkVersiondefault used in the webpack plugin. Looks good.
238-247: Regex tests around entry names look safe after escaping.Using
escapeRegex(name)and then constructingnew RegExp(\${escapedName}\.js$ `)` keeps the patterns literal and anchored, so even odd entry names can’t inject regex metacharacters. Given the simple structure and escaping, the static “regex-from-variable” warning here can be treated as a false positive.Also applies to: 279-279
253-277: Encode plugin wiring is straightforward and matches the options contract.
externalBundleRsbuildPluginlazily imports@lynx-js/tasm, derivesbundleFileNamefromenvironment.name, and forwards the (possibly undefined)targetSdkVersiontoExternalBundleWebpackPlugin, which then applies its own'3.4'default. This keeps the package loosely coupled to tasm and avoids loading it unless the plugin is actually used. Implementation looks solid.packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (4)
11-42: Options interface and docs are aligned with usage.
ExternalBundleWebpackPluginOptionsmatches how the class uses it (stringbundleFileName, asyncencodereturning{ buffer }, optionaltargetSdkVersiondefaulted later), and the JSDoc examples usinggetEncodeMode()from@lynx-js/tasmare consistent with the surrounding code and tests.
44-51: Debug flag helper is simple and targeted.
isDebug()’sDEBUGparsing (comma‑split, case‑insensitive, matchingrsbuild,rspeedy, or*) is straightforward and avoids extra work when the env var is unset. This is a reasonable scope for enabling the extratasm.jsonoutput.
61-111: Asset hook and bundle emission logic look correct.Hooking at
PROCESS_ASSETS_STAGE_OPTIMIZE_HASHensures all JS assets are ready before encoding. Capturingassets = compilation.getAssets()beforeemitAssetand then deleting from that list guarantees the newly emitted external bundle isn’t removed. The debug branch emittingtasm.jsonvs. pruning original assets in non‑debug builds is a clear, predictable behavior.
113-140: Encoding pipeline and JS asset handling are sound.
#encodecorrectly:
- Filters to
.jsassets,- Strips only the trailing
.jsvia/\.js$/, avoiding earlier multi‑.jsedge cases,- Reads content with
cur.source.source().toString(), and- Builds
encodeOptionswithenableFiberArchand a defaultedtargetSdkVersionof'3.4'.This matches the documented expectations for the external bundle encoder and keeps the options object JSON‑serializable for the debug artifact.
colinaaa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @lynx-js/[email protected] ### Minor Changes - **BREAKING CHANGE**: Delay the `createSnapshot` operation to `Snapshot` constructor to speed up IFR. ([#1899](#1899)) This change refactors how snapshots are created and registered: - Removed the `entryUniqID` function - Snapshots are now lazily created via `snapshotCreatorMap` instead of eagerly at bundle load time - Snapshot IDs are generated at compile time and only prefixed with `${globDynamicComponentEntry}:` for standalone lazy bundles **⚠️ Lazy Bundle Compatibility:** - **Backward compatibility (new runtime → old lazy bundles)**: ✅ **Supported**. Old lazy bundles will work with the new runtime. - **Forward compatibility (old runtime → new lazy bundles)**: ❌ **NOT Supported**. Lower version consumers **will not be able to load lazy bundles produced by this version** due to the changed snapshot creation mechanism. **Migration guidance**: If you are using lazy bundles, ensure all consumers are upgraded to this version or later **before** deploying lazy bundles built with this version. For monorepo setups, coordinate the upgrade across all consuming applications. ### Patch Changes - Preserve assignments to webpack runtime variables like `__webpack_public_path__`, `__webpack_require__.p`, etc. ([#1958](#1958)) - Fixed blank screen issues with nested lists. Lazily created nested lists were being flushed but not properly recorded, causing rendering failures. ([#1963](#1963)) - fix: export `createRef` and `useRef` from `@lynx-js/react/legacy-react-runtime` ([#1953](#1953)) ## @lynx-js/[email protected] ### Minor Changes - **BREAKING CHANGE**: Require `@lynx-js/rspeedy` 0.12.0. ([#1951](#1951)) ### Patch Changes - Support Yarn Plug'n'Play. ([#1964](#1964)) - Updated dependencies \[[`738d44d`](738d44d), [`5bbb439`](5bbb439), [`3692a16`](3692a16), [`d2e290b`](d2e290b), [`738d44d`](738d44d)]: - @lynx-js/[email protected] - @lynx-js/[email protected] - @lynx-js/[email protected] - @lynx-js/[email protected] - @lynx-js/[email protected] - @lynx-js/[email protected] ## @lynx-js/[email protected] ### Minor Changes - **BREAKING CHANGE**: Use resolver from Rspack. ([#1964](#1964)) The `createLazyResolver` now requires an `rspack` parameter: ```diff - function createLazyResolver(directory: string, conditionNames: string[]): (request: string) => Promise<string>; + function createLazyResolver(rspack: rspack, directory: string, conditionNames: string[]): (request: string) => Promise<string>; ``` ### Patch Changes - Support Yarn Plug'n'Play. ([#1964](#1964)) ## @lynx-js/[email protected] ### Minor Changes - feat: new flex:val impl ([#1979](#1979)) ### Patch Changes - Updated dependencies \[[`40c3a1a`](40c3a1a), [`46bd5ee`](46bd5ee)]: - @lynx-js/[email protected] - @lynx-js/[email protected] - @lynx-js/[email protected] - @lynx-js/[email protected] ## @lynx-js/[email protected] ### Minor Changes - feat: new flex:val impl ([#1979](#1979)) ### Patch Changes - fix: x-input display should add !important to avoid override ([#1960](#1960)) - Updated dependencies \[]: - @lynx-js/[email protected] ## @lynx-js/[email protected] ### Patch Changes - Bump Rsbuild v1.6.9 with Rspack v1.6.5. ([#1967](#1967)) - Updated dependencies \[]: - @lynx-js/[email protected] ## [email protected] ### Patch Changes - Bump `@rsbuild/plugin-type-check` v1.3.1. ([#1964](#1964)) ## @lynx-js/[email protected] ### Patch Changes - Add `@lynx-js/lynx-bundle-rslib-config` for bundling Lynx bundle with [Rslib](https://rslib.rs/): ([#1943](#1943)) ```js // rslib.config.js import { defineExternalBundleRslibConfig } from "@lynx-js/lynx-bundle-rslib-config"; export default defineExternalBundleRslibConfig({ id: "utils-lib", source: { entry: { utils: "./src/utils.ts", }, }, }); ``` ## @lynx-js/[email protected] ### Patch Changes - Updated dependencies \[]: - @lynx-js/[email protected] ## @lynx-js/[email protected] ### Patch Changes - chore: update web-elements version of web-explorer ([#1962](#1962)) ## @lynx-js/[email protected] ### Patch Changes - fix: capture and bind event listener should be trigger correctly ([#1972](#1972)) - fix: the l-p-comp-uid of page should be '1' ([#1970](#1970)) - Updated dependencies \[]: - @lynx-js/[email protected] ## @lynx-js/[email protected] ### Patch Changes - Updated dependencies \[[`40c3a1a`](40c3a1a), [`46bd5ee`](46bd5ee)]: - @lynx-js/[email protected] - @lynx-js/[email protected] - @lynx-js/[email protected] ## @lynx-js/[email protected] ### Patch Changes - Set main thread JS basename to `lepusCode.filename` in tasm encode data. It will ensure a filename is reported on MTS error without devtools enabled. ([#1949](#1949)) ## @lynx-js/[email protected] ### Patch Changes - Set main thread JS basename to `lepusCode.filename` in tasm encode data. It will ensure a filename is reported on MTS error without devtools enabled. ([#1949](#1949)) - Upgrade `@lynx-js/tasm` to `0.0.20`. ([#1943](#1943)) - refactor: move web style info generation to the encode phase ([#1975](#1975)) ## [email protected] ## @lynx-js/[email protected] ## @lynx-js/[email protected] ## @lynx-js/[email protected] ## @lynx-js/[email protected] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
Documentation
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.
Checklist