Skip to content
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

Steve/v3-prepear-react-19 #4593

Merged
merged 97 commits into from
Jan 12, 2025
Merged

Steve/v3-prepear-react-19 #4593

merged 97 commits into from
Jan 12, 2025

Conversation

weareoutman
Copy link
Member

@weareoutman weareoutman commented Jan 12, 2025

依赖检查

组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。

请勾选以下两组选项其中之一:

  • 本次 MR 没有使用上游组件(例如框架、后台组件等)的较新版本提供的特性。

或者:

  • 本次 MR 使用了上游组件(例如框架、后台组件等)的较新版本提供的特性。
  • 在对应的文件中更新了该上游组件的依赖版本(或确认了当前声明的依赖版本已包含本次 MR 使用的新特性)。

提交信息检查

Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。

破坏性变更是针对于下游使用者而言,可以通过本次改动对下游使用者的影响来识别变更类型:

  • 下游使用者不做任何改动,仍可以正常工作时,那么它属于普通变更。
  • 反之,下游使用者不做改动就无法正常工作时,那么它属于破坏性变更。

例如,构件修改了一个属性名,小产品 Storyboard 中需要使用新属性名才能工作,那么它就是破坏性变更。
又例如,构件还没有任何下游使用者,那么它的任何变更都是普通变更。

破坏性变更:

  • ⚠️ 本次 MR 包含破坏性变更的提交,请继续确认以下所有选项:
  • 没有更好的兼容方案,必须做破坏性变更。
  • 使用了 feat 作为提交类型。
  • 标注了 BREAKING CHANGE: 你的变更说明
  • 同时更新了本仓库中所有下游使用者的调用。
  • 同时更新了本仓库中所有下游使用者对该子包的依赖为即将发布的 major 版本。
  • 同时为其它仓库的 Migrating 做好了准备,例如文档或批量改动的方法。
  • 手动验证过破坏性变更在 Migrate 后可以正常工作。
  • 破坏性变更所在的提交没有意外携带其它子包的改动。

新特性:

  • 本次 MR 包含新特性的提交,且该提交不带有破坏性变更,并使用了 feat 作为提交类型。
  • 给新特性添加了单元测试。
  • 手动验证过新特性可以正常工作。

问题修复:

  • 本次 MR 包含问题修复的提交,且该提交不带有新特性或破坏性变更,并使用了 fix 作为提交类型。
  • 给问题修复添加了单元测试。
  • 手动验证过问题修复得到解决。

杂项工作:

即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:

  • 本次 MR 包含杂项工作的提交,且该提交不带有问题修复、新特性或破坏性变更,并使用了 chore, docs, test 等作为提交类型。

Summary by CodeRabbit

  • 依赖项变更

    • 移除了 @next-core/brick-container@next-core/brick-playground@next-core/test-next 开发依赖
    • 调整了 react-i18next 依赖的管理方式
    • 移除了 @testing-library/react@testing-library/react-hooks 测试依赖
    • 更新了多个依赖项的版本,包括 @babel/core@babel/typescypresseslint-plugin-reactprettier
  • 测试工具

    • 更新了测试库 @testing-library/react 的版本至 ^16.1.0
  • 国际化

    • 优化了国际化模块的引入和使用方式
    • 简化了翻译函数的调用机制
  • 构建过程

    • 增强了构建过程中的日志输出功能
    • 移除了不再使用的 JSON 配置文件 common-bricks.json

renovate bot and others added 30 commits September 26, 2024 02:33
chore(deps): Update cypress packages to ^13.15.0 (next)
…react-7.x

chore(deps): Update dependency eslint-plugin-react to v7.37.1 (next)
chore(deps): Update babel monorepo to ^7.25.7 (next)
…-env-10.x

chore(deps): Update dependency postcss-preset-env to ^10.0.6 (next)
…dleware-3.x

chore(deps): Update dependency http-proxy-middleware to ^3.0.3 (next)
chore(deps): Update dependency express to ^4.21.1 (next)
chore(deps): Update dependency typescript to ^5.6.3 (next)
chore(deps): Update dependency webpack to ^5.95.0 (next)
chore(deps): Update babel monorepo to ^7.25.8 (next)
…-env-10.x

chore(deps): Update dependency postcss-preset-env to ^10.0.7 (next)
chore(deps): Update dependency tslib to ^2.8.0 (next)
…y-monorepo

chore(deps): Update dependency @testing-library/jest-dom to ^6.6.1 (next)
…y-monorepo

chore(deps): Update dependency @testing-library/jest-dom to ^6.6.2 (next)
…extractor-7.x

chore(deps): Update dependency @microsoft/api-extractor to ^7.47.11 (next)
Copy link

coderabbitai bot commented Jan 12, 2025

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/babel-preset-next/index.js

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "@next-core/eslint-config-next" to extend from. Please check that the name of the config is correct.

The config "@next-core/eslint-config-next" was referenced from the config file in "/.eslintrc".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

概述

代码变更总览

本次代码变更主要涉及依赖管理、测试框架和国际化(i18n)相关的多个文件和包。变更包括移除特定开发依赖、更新测试库导入和调整国际化处理方式。这些修改可能会影响项目的构建、测试和国际化支持。

变更详情

文件/路径 变更摘要
package.json 移除三个开发依赖:@next-core/brick-container@next-core/brick-playground@next-core/test-next;更新多个依赖版本;添加新依赖 @next-shared/common-bricks
packages/i18n/package.json 调整 react-i18next 依赖,从 dependencies 移至 devDependenciespeerDependencies;更新 i18next-browser-languagedetector 版本。
packages/react-runtime/package.json 移除测试相关开发依赖:@testing-library/react@testing-library/react-hooks
packages/react-runtime/src/useProvider/* 更新测试文件中的测试库导入和异步测试处理方式。
packages/test-next/package.json 更新多个依赖版本,包括 @babel/core@testing-library/react
packages/test-next/src/transforms/file.js 重构 SVG 文件处理逻辑,使用 ES 模块格式。
packages/yo/src/templates/brick/ 调整国际化相关代码,简化翻译函数使用方式。
bricks/e2e/package.json 移除构建目标输入中的 JSON 文件路径。
docker-compose.yml 更新 e2e 服务的 Docker 镜像版本。
packages/babel-preset-next/index.js 更新 Babel 预设和插件的配置。
packages/build-next-bricks/bin/build-next-bricks.js 添加构建过程的日志输出功能。
shared/common-bricks/common-bricks.json 移除包含 e2e 测试配置的 JSON 文件。

这些变更反映了项目在依赖管理、测试方法和国际化支持方面的持续优化和重构。

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
packages/test-next/src/transforms/file.js (1)

26-29: 建议添加类型定义以增强类型安全性

为了提供更好的开发体验和类型安全性,建议:

  1. 为 props 添加 TypeScript 接口定义
  2. 为 ref 指定具体的类型

示例实现:

interface SvgProps extends React.SVGProps<SVGSVGElement> {
  // 在此添加自定义属性
}

const ${componentName} = React.forwardRef<SVGSVGElement, SvgProps>((props, ref) => {
  // ... 现有实现
});
packages/react-runtime/src/useProvider/useProvider.spec.tsx (1)

35-38: 建议改进异步测试处理方式

当前实现使用了非标准的 global.flushPromises,建议采用更标准的方式处理异步测试。

建议使用以下方式改进:

- await (global as any).flushPromises();
+ await Promise.resolve();

这样可以:

  1. 避免使用 any 类型
  2. 使用更标准的 Promise 处理方式
  3. 提高代码可维护性

Also applies to: 46-46

packages/yo/src/templates/brick/i18n.ts (1)

1-1: 导入和使用 i18n 模块的实现看起来不错

这种实现方式将翻译功能从 React 组件中解耦出来,使其更加灵活和可重用。

不过建议添加一些注释来说明 getFixedT 的用途和 null 参数的含义。

 import { i18n } from "@next-core/i18n";

+// 创建一个绑定到特定命名空间的翻译函数
+// 第一个参数为 null 表示使用当前语言
 export const t = i18n.getFixedT(null, NS);

Also applies to: 18-18

packages/yo/src/templates/brick/index.tsx.hbs (1)

6-7: i18n 初始化和使用的改动合理

从 React 特定的 i18n 实现迁移到更通用的实现,这样的改动使代码更加灵活,减少了对 React 特定库的依赖。

建议在初始化之前添加错误处理。

{{#if useI18n}}
+try {
   initializeI18n(NS, locales);
+} catch (error) {
+  console.error("Failed to initialize i18n:", error);
+}
{{/if}}

Also applies to: 12-12

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74a5372 and ec94491.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (9)
  • package.json (0 hunks)
  • packages/i18n/package.json (1 hunks)
  • packages/react-runtime/package.json (0 hunks)
  • packages/react-runtime/src/useProvider/useProvider.spec.tsx (5 hunks)
  • packages/react-runtime/src/useProvider/useProviderArgs.spec.ts (1 hunks)
  • packages/test-next/package.json (1 hunks)
  • packages/test-next/src/transforms/file.js (1 hunks)
  • packages/yo/src/templates/brick/i18n.ts (2 hunks)
  • packages/yo/src/templates/brick/index.tsx.hbs (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/react-runtime/package.json
  • package.json
✅ Files skipped from review due to trivial changes (1)
  • packages/react-runtime/src/useProvider/useProviderArgs.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build (20.x)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (8)
packages/test-next/src/transforms/file.js (2)

8-11: 参数命名改进符合最佳实践!

使用下划线前缀(_src)明确表示该参数未被使用,这种命名约定提高了代码的可读性。


17-30: 架构改进显著提升了代码质量!

  1. 使用 ES 模块语法替代 CommonJS,符合现代 JavaScript 最佳实践
  2. 通过 React.forwardRef 支持 ref 转发,提高了组件的可复用性
  3. 支持了 /*#__PURE__*/ 注释,有助于树摇优化
packages/test-next/package.json (2)

Line range hint 1-47: 配置结构合理,批准变更

package.json 的整体结构完善,包含了必要的配置项。依赖版本的更新是一个小版本升级,风险相对较小。


38-38: 验证依赖版本和兼容性

建议验证 @testing-library/react ^16.1.0 的以下几点:

  1. 是否为最新的稳定版本
  2. 是否与其他测试库(dom ^10.4.0 和 jest-dom ^6.5.0)完全兼容
  3. 是否存在已知的安全问题

运行以下脚本以验证版本和兼容性:

✅ Verification successful

依赖版本验证完成,确认安全可用

经过验证:

  • 当前使用的 @testing-library/react ^16.1.0 是最新稳定版本
  • 未发现任何安全漏洞
  • 与其他测试库版本兼容性正常
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查 @testing-library/react 的最新版本和安全公告

# 检查 npm 上的最新版本
curl -s https://registry.npmjs.org/@testing-library/react/latest | jq '.version'

# 检查安全公告
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NPM, package: "@testing-library/react") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

# 检查与其他测试库的兼容性
rg -A 5 '@testing-library/(react|dom|jest-dom)' -g 'package.json'

Length of output: 1047

packages/react-runtime/src/useProvider/useProvider.spec.tsx (3)

1-1: 导入语句的更新符合最佳实践

从 @testing-library/react 导入 act 是一个很好的改进,这符合 React 18 及以后版本的测试最佳实践。


Line range hint 147-175: Suspense 测试实现得当

React Suspense 的测试实现非常规范,很好地覆盖了加载状态和渲染状态的验证。


Line range hint 1-175: 建议验证类型安全性

建议确保所有的类型定义都是明确的,特别是在使用 any 的地方。

运行以下命令来验证类型安全性:

✅ Verification successful

测试文件中的 any 类型使用是合理的

  • 所有 any 类型的使用都限定在测试场景中,包括测试工具函数(flushPromises)、测试组件和错误测试配置
  • 这些用法符合测试代码的常见模式,不会影响生产环境的类型安全性
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查文件中的 any 使用情况
rg "any[^a-zA-Z]" packages/react-runtime/src/useProvider/useProvider.spec.tsx

# 检查是否有未使用的类型导入
ast-grep --pattern 'import { $_ } from "@testing-library/react"'

Length of output: 878

packages/i18n/package.json (1)

46-59: 依赖关系的调整非常合理

react-i18next 移动到 devDependencies 和可选的 peerDependencies 中是一个很好的改进:

  • 减少了基础包的依赖
  • 使得非 React 项目可以使用这个包
  • 保持了与 React 项目的兼容性

建议验证所有依赖版本的兼容性。

✅ Verification successful

依赖版本兼容性验证通过

所有依赖版本都符合要求:

  • i18next ^22.5.1 满足 react-i18next 要求的最低版本 (>= 19.0.0)
  • react-i18next 对 React 的版本要求 (>= 16.8.0) 已合理声明为可选的 peer dependency
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查依赖版本的兼容性
npm info react-i18next@^12.3.1 peerDependencies
npm info i18next@^22.5.1 peerDependencies

Length of output: 142


Script:

#!/bin/bash
# Check i18next version in package.json
cat packages/i18n/package.json | jq -r '.dependencies.i18next // empty'

Length of output: 81

Copy link

cypress bot commented Jan 12, 2025

next-core    Run #10887

Run Properties:  status check passed Passed #10887  •  git commit 555487268b ℹ️: Merge 43aca449e0a28f17619a584dff08e916c0855f71 into 74a5372d7b667fa7d36c9a0c00db...
Project next-core
Branch Review steve/v3-prepear-react-19
Run status status check passed Passed #10887
Run duration 00m 27s
Commit git commit 555487268b ℹ️: Merge 43aca449e0a28f17619a584dff08e916c0855f71 into 74a5372d7b667fa7d36c9a0c00db...
Committer Shenwei Wang
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 16
View all changes introduced in this branch ↗︎

Copy link

cypress bot commented Jan 12, 2025

next-core    Run #10886

Run Properties:  status check passed Passed #10886  •  git commit b0bc56c016: Merge pull request #4596 from easyops-cn/renovate/next-core-js-3.x
Project next-core
Branch Review next
Run status status check passed Passed #10886
Run duration 00m 21s
Commit git commit b0bc56c016: Merge pull request #4596 from easyops-cn/renovate/next-core-js-3.x
Committer Shenwei Wang
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 15
View all changes introduced in this branch ↗︎

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/build-next-bricks/bin/build-next-bricks.js (2)

86-86: 增强了构建过程的可见性

在 watch 模式下添加了 stats 输出,这有助于开发人员更好地了解构建状态和性能指标。

建议考虑使用更详细的 stats 配置来优化输出信息:

-console.log(stats.toString());
+console.log(stats.toString({
+  colors: true,
+  modules: false,
+  children: false,
+  chunks: false,
+  chunkModules: false
+}));

97-97: 优化了构建输出信息

在常规构建模式下添加了 stats 输出,这对于持续集成环境下的构建监控很有帮助。

同样建议使用更精细的 stats 配置来提供更清晰的输出:

-console.log(stats.toString());
+console.log(stats.toString({
+  colors: true,
+  modules: false,
+  children: false,
+  chunks: false,
+  chunkModules: false
+}));
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec94491 and 43aca44.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (21)
  • bricks/e2e/package.json (1 hunks)
  • docker-compose.yml (1 hunks)
  • package.json (2 hunks)
  • packages/babel-preset-next/index.js (2 hunks)
  • packages/babel-preset-next/package.json (1 hunks)
  • packages/brick-container/package.json (2 hunks)
  • packages/brick-playground/package.json (2 hunks)
  • packages/build-next-bricks/bin/build-next-bricks.js (2 hunks)
  • packages/build-next-bricks/package.json (2 hunks)
  • packages/build-next-bricks/src/build.js (4 hunks)
  • packages/build-next-libs/package.json (1 hunks)
  • packages/cook/package.json (1 hunks)
  • packages/create-api-sdk/package.json (1 hunks)
  • packages/doc-helpers/package.json (1 hunks)
  • packages/eslint-config-next/package.json (1 hunks)
  • packages/i18n/package.json (1 hunks)
  • packages/preview/package.json (1 hunks)
  • packages/runtime/package.json (1 hunks)
  • packages/test-next/package.json (1 hunks)
  • packages/webpack/package.json (1 hunks)
  • shared/common-bricks/common-bricks.json (0 hunks)
💤 Files with no reviewable changes (1)
  • shared/common-bricks/common-bricks.json
✅ Files skipped from review due to trivial changes (3)
  • packages/preview/package.json
  • packages/build-next-libs/package.json
  • docker-compose.yml
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/test-next/package.json
  • packages/i18n/package.json
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build (20.x)
🔇 Additional comments (20)
packages/webpack/package.json (1)

22-22: 请验证 webpack 版本更新的兼容性

webpack 版本从 ^5.94.0 更新到 ^5.97.1,需要确认此版本更新是否包含重大变更。

运行以下脚本检查 webpack 5.94.0 到 5.97.1 之间的变更日志:

Also applies to: 25-25

✅ Verification successful

webpack 版本更新验证完成,发现以下需要注意的变更

此次版本更新(5.94.0 -> 5.97.1)主要包含bug修复和功能增强,但有几处值得注意的变更:

  • 在 v5.97.0 中移除了 output.cssHeadDataCompression 配置选项
  • v5.96.0 中修改了 css/auto 的处理逻辑,现在会根据文件名决定是作为纯CSS还是CSS模块处理
  • v5.95.0 引入了新的 optimization.avoidEntryIife 选项(生产环境默认为 true)

建议:

  • 如果项目使用了CSS/CSS模块功能,请进行充分测试
  • 检查是否使用了已移除的 cssHeadDataCompression 选项
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查 webpack 5.94.0 到 5.97.1 之间的变更日志

# 获取 webpack 仓库的发布说明
gh api \
  -H "Accept: application/vnd.github+json" \
  repos/webpack/webpack/releases \
  --jq 'map(select(.tag_name | startswith("v5.") and . >= "v5.94.0" and . <= "v5.97.1")) | .[] | {tag: .tag_name, body: .body}'

Length of output: 5569

packages/eslint-config-next/package.json (1)

16-16: 验证 eslint-plugin-react 版本更新的兼容性

建议验证 eslint-plugin-react 7.37.2 版本的变更是否与 React 19 的准备工作相符,并确认是否存在破坏性更新。

运行以下脚本以检查版本兼容性和更新日志:

✅ Verification successful

eslint-plugin-react 7.37.2 版本更新与 React 19 兼容

此版本更新是安全的,并且支持 React 19 的准备工作。更新内容包括:

  • 支持 React 19 中的新属性
  • 修复了类型声明和组件验证相关的问题
  • 与其他依赖版本保持兼容
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查 eslint-plugin-react 7.37.2 的更新日志和兼容性

# 获取 package.json 中的其他依赖版本信息
echo "当前依赖版本:"
cat packages/eslint-config-next/package.json | jq '.peerDependencies'

# 检查 eslint-plugin-react 的更新日志
gh api repos/jsx-eslint/eslint-plugin-react/releases | jq -r '.[] | select(.tag_name | contains("v7.37")) | {tag_name: .tag_name, body: .body}'

Length of output: 106975

bricks/e2e/package.json (1)

23-23: 请验证构建输入的变更影响

从构建输入中移除 {workspaceRoot}/shared/common-bricks/common-bricks.json 可能会影响构建过程。建议确认以下几点:

  1. 共享资源是否已迁移到新的位置
  2. 构建过程是否仍能正常进行
  3. 是否需要更新相关的文档

运行以下脚本来验证是否有其他文件仍在引用已移除的 common-bricks.json:

✅ Verification successful

构建输入变更已得到验证

经过分析,从 bricks/e2e/package.json 的构建输入中移除 {workspaceRoot}/shared/common-bricks/common-bricks.json 是安全的,原因如下:

  • 相关配置已迁移至 @next-shared/common-bricks 包中
  • 其他依赖该文件的代码已更新为使用包依赖方式访问

这个变更符合现代依赖管理最佳实践,提供了更好的版本控制和封装性。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 搜索可能引用 common-bricks.json 的文件
rg -l "common-bricks\.json"

# 检查是否有其他构建配置文件使用类似的模式
fd -e json -x grep -l "workspaceRoot.*common-bricks" {} \;

Length of output: 161


Script:

#!/bin/bash
# 检查 common-bricks.json 的引用上下文
echo "=== plopfile.js 内容 ==="
rg -A 5 -B 5 "common-bricks\.json" packages/yo/src/plopfile.js

echo -e "\n=== build.js 内容 ==="
rg -A 5 -B 5 "common-bricks\.json" packages/build-next-bricks/src/build.js

# 检查是否有相关的配置迁移
echo -e "\n=== 查找可能的新配置文件 ==="
fd -e json -x grep -l "common-bricks" {} \;

Length of output: 2680

packages/runtime/package.json (1)

64-64: 检查 api-extractor 版本更新的兼容性

从 ^7.47.9 升级到 ^7.47.11 是一个小版本更新。由于这是开发依赖项,不会影响运行时行为,主要用于生成 API 文档。

运行以下脚本以验证版本更新的影响:

✅ Verification successful

api-extractor 版本更新验证完成

经验证,此次从 ^7.47.9 到 ^7.47.11 的小版本更新仅影响 runtime 包的开发环境,不会对运行时行为造成影响。api-extractor 的使用范围已确认仅限于 API 文档生成。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查 api-extractor 的更新日志,确认是否存在重大变更

# 获取 api-extractor 的发布说明
gh api repos/microsoft/api-extractor/releases \
  --jq '.[] | select(.tag_name | startswith("v7.47.")) | {tag: .tag_name, body: .body}'

Length of output: 279


Script:

#!/bin/bash
# 查找 api-extractor 配置文件和使用情况

# 搜索 api-extractor.json 配置文件
echo "=== API Extractor 配置文件 ==="
fd "api-extractor.json"

# 搜索包含 api-extractor 的 package.json 脚本
echo -e "\n=== 在 package.json 中的使用 ==="
fd "package.json" --exec grep -l "api-extractor" {}

# 搜索可能的自定义配置
echo -e "\n=== 相关代码引用 ==="
rg --type-add 'config:*.{json,js,ts}' -t config "api-extractor" -l

Length of output: 493

packages/brick-playground/package.json (2)

28-29: 请验证 compression 和 express 包的更新是否包含重要变更

建议在部署前验证这些依赖项的更新是否会影响现有功能。

运行以下脚本检查更新日志中的重要变更:

✅ Verification successful

express 4.21.1 包含重要安全更新,建议及时升级

express 4.21.1 修复了安全漏洞 CVE-2024-47764。compression 1.7.5 仅包含维护性更新,无重大变更。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查 compression 和 express 包的更新日志

# 获取 compression 包的发布说明
echo "检查 compression 包的更新..."
gh api repos/expressjs/compression/releases | jq '.[] | select(.tag_name=="1.7.5") | .body'

# 获取 express 包的发布说明
echo "检查 express 包的更新..."
gh api repos/expressjs/express/releases | jq '.[] | select(.tag_name=="4.21.1") | .body'

Length of output: 2084


38-38: 请验证 html-webpack-plugin 的更新

建议确认此更新与当前的 webpack 配置兼容。

运行以下脚本检查更新内容:

✅ Verification successful

html-webpack-plugin 5.6.3 更新验证完成

经检查,此版本与项目中使用的 webpack 5.x 完全兼容,配置使用简单标准,更新安全。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查 html-webpack-plugin 包的更新日志

echo "检查 html-webpack-plugin 包的更新..."
gh api repos/jantimon/html-webpack-plugin/releases | jq '.[] | select(.tag_name=="5.6.3") | .body'

# 检查项目中的 webpack 配置
echo "检查 webpack 配置..."
fd -e js -e ts webpack.config

Length of output: 246


Script:

#!/bin/bash
# 搜索 webpack 相关配置文件
echo "搜索 webpack 配置文件..."
fd -t f -e js -e ts -e cjs -e mjs . | rg -i 'webpack|build'

# 检查 webpack 版本
echo "检查 webpack 版本..."
cat packages/brick-playground/package.json | jq '.dependencies.webpack, .devDependencies.webpack'

# 搜索 html-webpack-plugin 的使用
echo "搜索 html-webpack-plugin 使用..."
rg -l "html-webpack-plugin" --type js --type ts

Length of output: 1811


Script:

#!/bin/bash
# 检查构建配置文件中的 html-webpack-plugin 使用
echo "检查构建配置文件..."
cat packages/brick-playground/build.config.js

# 检查其他包中的 webpack 版本
echo "检查 webpack 版本..."
find . -name package.json -exec sh -c 'echo "=== $1 ==="; cat "$1" | jq -r ".dependencies.webpack, .devDependencies.webpack"' sh {} \;

# 检查 html-webpack-plugin 的具体配置
echo "检查插件配置..."
rg -A 5 "html-webpack-plugin" --type js

Length of output: 44756

packages/babel-preset-next/index.js (2)

29-29: 检查 CoreJS 版本更新的兼容性

CoreJS 版本从 3.38 更新到 3.40,建议验证此更新是否与项目的其他依赖兼容。

✅ Verification successful

CoreJS 版本更新验证完成

经过验证,从 CoreJS 3.38 升级到 3.40 是一个次要版本更新,遵循语义化版本控制规范,向后兼容且安全。未发现项目中使用任何 CoreJS 3.40 特有的新特性,此更新可以安全进行。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查项目中是否存在使用了仅在 CoreJS 3.40 版本中支持的新特性
rg -l 'Array\.fromAsync|Promise\.withResolvers|Array\.groupBy|Array\.groupByToMap'

Length of output: 84


Script:

#!/bin/bash
# Search for CoreJS related imports and configurations
echo "=== Searching for CoreJS imports and usages ==="
rg -l "require\(['\"](core-js|@babel/runtime-corejs3)" 

echo -e "\n=== Checking package.json files for CoreJS dependencies ==="
fd package.json --exec cat {} | jq -c 'select(.dependencies["core-js"] or .devDependencies["core-js"] or .dependencies["@babel/runtime-corejs3"] or .devDependencies["@babel/runtime-corejs3"])'

Length of output: 555


52-52: 确认 Babel Runtime 版本升级的影响

@babel/runtime 版本从 7.25.6 更新到 7.26.0,这是一个次要版本更新。

✅ Verification successful

@babel/runtime 版本更新验证完成

经过验证,从 7.25.6 升级到 7.26.0 的更新是安全的:

  • 这是一个次要版本更新
  • 更新是整个 Babel 生态系统协调更新的一部分
  • 项目中主要使用标准的运行时 helpers
  • 版本已在 resolutions 中正确锁定,确保了依赖一致性
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查是否有使用了 @babel/runtime 7.26.0 中新增或修改的功能
rg -l '@babel/runtime.*7\.26\.0'

Length of output: 97


Script:

#!/bin/bash
# Check actual usage of @babel/runtime
echo "=== Searching for @babel/runtime imports ==="
rg "@babel/runtime" --type js -A 2

echo -e "\n=== Checking package.json files for @babel/runtime dependencies ==="
fd package.json --exec grep -l "@babel/runtime" {} \; --exec echo "=== {}" \; --exec cat {}

Length of output: 4324

packages/build-next-bricks/src/build.js (4)

10-11: 优化了公共构件配置的导入方式

使用 JSON 模块导入替代了文件系统读取,这样的改进更加清晰和高效。


Line range hint 79-121: 改进了公共构件冲突检测逻辑

新的实现更好地处理了废弃构件的情况,并提供了更清晰的错误信息。


255-255: 更新了错误消息中的路径引用

错误消息现在正确引用了 @next-shared/common-bricks/common-bricks.json 的路径。


200-214: 优化了共享包配置逻辑

改进了版本要求的处理方式,特别是对于单例包的处理。建议验证这些更改对构建输出的影响。

✅ Verification successful

共享包配置逻辑的优化验证完成

经过验证,代码改动符合以下要点:

  • 与现有类型定义和运行时插件实现保持一致
  • 对 react-dom 的特殊处理遵循模块联邦最佳实践
  • 单例包的处理逻辑完善且安全
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查是否有其他地方引用了这些共享包配置
rg -l 'sharedSingletonPackages|moduleFederationShared'

Length of output: 242


Script:

#!/bin/bash
# Check implementation details
echo "=== RuntimePlugin.js shared package handling ==="
rg -A 5 "sharedSingletonPackages|moduleFederationShared" "packages/webpack/src/RuntimePlugin.js"

echo -e "\n=== build.config.js configuration ==="
cat "packages/brick-playground/build.config.js"

echo -e "\n=== Type definitions ==="
cat "packages/webpack/index.d.ts"

Length of output: 6357

packages/babel-preset-next/package.json (1)

14-19: Babel 相关依赖进行了版本更新

多个 Babel 相关依赖包进行了次要版本更新,建议:

  1. 确保所有更新的版本之间相互兼容
  2. 验证这些更新不会影响现有的构建输出
✅ Verification successful

Babel 依赖版本更新验证完成

经过验证,所有 Babel 相关依赖的版本更新是安全的:

  • 所有版本都使用了兼容性版本范围(^)
  • @babel/runtime 在项目中保持版本一致(^7.26.0)
  • 版本差异(7.25.9 与 7.26.x)在次要版本范围内,保持向后兼容
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查项目中是否存在使用了这些 Babel 插件的特定版本
rg -l '@babel/(?:plugin|preset|runtime).*7\.2[56]'

Length of output: 115


Script:

#!/bin/bash
# Check the actual Babel dependency versions in package.json files
echo "=== Root package.json ==="
rg '"@babel/(?:plugin|preset|runtime).*"' package.json

echo -e "\n=== babel-preset-next/package.json ==="
rg '"@babel/(?:plugin|preset|runtime).*"' packages/babel-preset-next/package.json

Length of output: 578

packages/doc-helpers/package.json (1)

33-33: 更新了 Prettier 版本

Prettier 版本从 3.3.3 更新到 3.4.2,建议验证此更新是否会影响现有的代码格式化规则。

✅ Verification successful

Prettier 版本更新验证完成

经验证,所有包都统一使用了 Prettier ^3.4.2 版本,版本一致性得到了良好维护。此更新不会导致项目内的格式化不一致问题。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查项目中的 Prettier 配置文件
fd -t f -e json -e yaml -e js '\.prettier'

Length of output: 44


Script:

#!/bin/bash
# Check for prettier configs in package.json files
echo "=== Prettier configs in package.json files ==="
rg '"prettier":\s*{' -A 5 -g 'package.json'

echo -e "\n=== Prettier-related scripts ==="
rg '"scripts".*format' -A 5 -g 'package.json'

echo -e "\n=== Prettier dependencies in other packages ==="
rg '"prettier":\s*".*"' -g 'package.json'

Length of output: 747

packages/create-api-sdk/package.json (1)

52-54: 依赖版本更新提醒

prettier 升级到 3.4.2 可能会带来代码格式化的变化,建议在合并前进行以下验证:

  1. 运行格式化命令检查是否有重大格式变化
  2. 确认团队所有成员更新到相同版本以保持一致性
packages/build-next-bricks/package.json (2)

61-62: 新增对 @next-shared/common-bricks 的对等依赖

这表明该包现在依赖于共享组件库。请确保:

  1. 所有使用此包的项目都已安装 @next-shared/common-bricks
  2. 文档中已更新相关依赖要求
  3. CI/CD 流程已适配此变更

37-38: 构建工具链版本更新

多个构建相关依赖进行了版本升级,包括 Babel、webpack、postcss 等。建议:

  1. 在开发环境完整测试构建流程
  2. 检查构建产物是否有异常
  3. 验证构建性能是否受影响

Also applies to: 49-56

packages/cook/package.json (1)

52-52: Babel 解析器版本更新

@babel/parser 升级到 7.26.5 版本,这是整个项目 Babel 工具链升级的一部分。建议:

  1. 确保所有相关的 Babel 包版本保持一致
  2. 验证现有的语法解析是否正常工作
packages/brick-container/package.json (2)

42-43: 服务器依赖更新

express 和 compression 包版本更新,虽然是小版本更新,但建议:

  1. 验证服务器启动和运行状态
  2. 检查压缩功能是否正常
  3. 进行负载测试确保性能稳定

68-69: 核心运行时依赖更新

core-js 升级到 3.40.0 版本,可能影响 polyfill 行为。建议:

  1. 在不同浏览器中测试兼容性
  2. 检查打包后的文件大小变化
  3. 验证关键功能在旧版浏览器中的表现

@weareoutman weareoutman merged commit c4f8dc4 into v3 Jan 12, 2025
8 checks passed
@weareoutman weareoutman deleted the steve/v3-prepear-react-19 branch January 12, 2025 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant