Skip to main content

Electron 37.0.0

· 13 min read

Electron 37.0.0 现已发布!它包含对 Chromium 138、V8 13.8 和 Node 22.16.0 的升级。

¥Electron 37.0.0 has been released! It includes upgrades to Chromium 138, V8 13.8, and Node 22.16.0.


Electron 团队很高兴地宣布 Electron 37.0.0 正式发布!你可以通过 npm install electron@latest 使用 npm 安装它,也可以从我们的 发布网站。继续阅读以了解有关此版本的详细信息。

¥The Electron team is excited to announce the release of Electron 37.0.0! You can install it with npm via npm install electron@latest or download it from our releases website. Continue reading for details about this release.

如果你有任何反馈,请在 BlueskyMastodon 上与我们分享,或加入我们的社区 Discord!可以在 Electron 的 问题跟踪器 中报告错误和功能请求。

¥If you have any feedback, please share it with us on Bluesky or Mastodon, or join our community Discord! Bugs and feature requests can be reported in Electron's issue tracker.

显著变化

¥Notable Changes

平滑转角:原生 CSS 圆角矩形

¥Smooth Corners: Native CSS Squircles

An image showing different corner smoothing values (0%, 30%, 60%, and 100%) applied to rectangles, with 60% labeled as matching macOS style

Electron 37 引入了自定义 -electron-corner-smoothing CSS 属性,允许应用创建更平滑的圆角,以匹配 Apple 的 macOS 设计语言。此功能最初在 Electron 36 中推出,但我们认为它应该得到更多的关注。

¥Electron 37 introduces the custom -electron-corner-smoothing CSS property, which allows apps to create smoother rounded corners to match Apple's macOS design language. This feature originally landed in Electron 36, but we felt like it deserved a brighter spotlight.

Example with 100% Corner Smoothing

代码结果
.box {
width: 128px;
height: 128px;
border-radius: 24px;
-electron-corner-smoothing: 100%;
}

与标准 border-radius 属性(从矩形中雕刻出四分之一圆角)不同,-electron-corner-smoothing 属性将曲线平滑过渡为具有连续周长的 squircle 形状。

¥Unlike the standard border-radius property, which carves quarter-circle corners out of a rectangle, -electron-corner-smoothing smoothly transitions the curve into a squircle shape with a continuous perimeter.

你可以使用 0% 到 100% 之间的值调整平滑度,或者使用 system-ui 的值来匹配操作系统的风格(macOS 上为 60%,其他系统上为 0%)。此设计增强功能可应用于边框、轮廓和阴影,为你的应用增添一层微妙的光泽。

¥You can adjust the smoothness using values from 0% to 100%, or use the system-ui value to match the operating system's style (60% on macOS and 0% otherwise). This design enhancement can be applied on borders, outlines, and shadows, giving your app a subtle layer of polish.

[!TIP] 了解更多关于 Electron 的圆角矩形实现,请参阅 @clavinRFC 0012。本文档更详细地介绍了实现动机和技术实现。

¥[!TIP] Read more about Electron's squircle implementation in @clavin's RFC 0012. The document goes over the motivation and technical implementation in more detail.

初始设计灵感源自 Figma 的圆角平滑实现。了解更多关于他们在 "急切地寻找圆角矩形" 中对平滑转角的追求。

¥The initial design drew inspiration from Figma's corner smoothing implementation. Read more about their own quest for smooth corners in "Desperately seeking squircles".

技术栈变更

¥Stack Changes

Electron 37 将 Chromium 从 136.0.7103.48 升级到 138.0.7204.35,V8 从 13.6 升级到 13.8

¥Electron 37 upgrades Chromium from 136.0.7103.48 to 138.0.7204.35, and V8 from 13.6 to 13.8.

Google Summer of Code 开始

¥Google Summer of Code Begins

我们的两位 Google Summer of Code 贡献者已经开始了程序的编码工作!

¥Our two Google Summer of Code contributors have started the program's coding period!

  • @nilayarya 正在 Electron 核心中构建一个新的 保存/恢复窗口状态 API。新的 API 将提供一种内置的标准化方法来处理窗口状态的持久性。请参阅 Nilay 正在进行的 RFC electron/rfcs#16

    ¥@nilayarya is crafting a new Save/Restore Window State API in Electron core. The new APIs will provide a built-in, standardized way to handle window state persistence. See Nilay's in-progress RFC at electron/rfcs#16.

  • @hitarth-gg 正在努力使用 Chrome Manifest V3 API 对长期搁置的 Devtron 扩展程序进行现代化升级。本项目将为开发者提供工具,用于调试 IPC 通信、跟踪事件监听器以及可视化 Electron 应用中的模块依赖。

    ¥@hitarth-gg is hard at work modernizing the long-dormant Devtron extension using Chrome Manifest V3 APIs. This project will provide tooling for developers to debug IPC communication, track event listeners, and visualize module dependencies in their Electron applications.

对于我们的 GSOC 参与者来说,这几周是令人兴奋的,敬请期待更多更新!

¥It has been an exciting couple of weeks for our GSOC participants, so stay tuned for more updates!

新功能和改进

¥New Features and Improvements

  • window.open 添加了 innerWidthinnerHeight 选项。#470393536 中也支持)

    ¥Added innerWidth and innerHeight options for window.open. #47039 (Also in 35, 36)

  • 添加了 before-mouse-event 属性,允许在 webContents 中拦截和阻止鼠标事件。#4736436 中也包含)

    ¥Added before-mouse-event to allow intercepting and preventing mouse events in webContents. #47364 (Also in 36)

  • ServiceWorkerMain 中添加了 scriptURL 属性。#45863

    ¥Added scriptURL property to ServiceWorkerMain. #45863

  • 在 macOS >= 14.4 版本上,为菜单添加了 sublabel 功能。#470423536 中也支持)

    ¥Added sublabel functionality for menus on macOS >= 14.4. #47042 (Also in 35, 36)

  • 添加了对 HIDDevice.collections 的支持。#4748336 中也包含)

    ¥Added support for HIDDevice.collections. #47483 (Also in 36)

  • 添加了对 --no-experimental-global-navigator 标志的支持。#474183536 中也支持)

    ¥Added support for --no-experimental-global-navigator flag. #47418 (Also in 35, 36)

  • 在 Linux X11 上添加了对 screen.dipToScreenPoint(point)screen.screenToDipPoint(point) 的支持。#468953536 中也支持)

    ¥Added support for screen.dipToScreenPoint(point) and screen.screenToDipPoint(point) on Linux X11. #46895 (Also in 35, 36)

  • 在 macOS 上添加了对菜单项角色 paletteheader 的支持。#47245

    ¥Added support for menu item role palette and header on macOS. #47245

  • 添加了对节点选项 --experimental-network-inspection 的支持。#470313536 中也支持)

    ¥Added support for node option --experimental-network-inspection. #47031 (Also in 35, 36)

  • 公开 win.isContentProtected() 接口,允许开发者检查窗口保护状态。#4731036 中也包含)

    ¥Exposed win.isContentProtected() to allow developers to check window protection status. #47310 (Also in 36)

重大变化

¥Breaking Changes

实用程序处理未处理的拒绝行为变更

¥Utility Process unhandled rejection behavior change

当发生未处理的拒绝时,实用程序进程现在会发出错误消息警告,而不是导致进程崩溃。

¥Utility Processes will now warn with an error message when an unhandled rejection occurs instead of crashing the process.

要恢复之前的行为,你可以使用:

¥To restore the previous behavior, you can use:

process.on('unhandledRejection', () => {
process.exit(1);
});

行为改变:process.exit() 同步终止实用程序进程

¥Behavior Changed: process.exit() kills utility process synchronously

在实用程序进程中调用 process.exit() 现在将同步终止该实用程序进程。这使得 process.exit() 的行为与 Node.js 的行为保持一致。

¥Calling process.exit() in a utility process will now kill the utility process synchronously. This brings the behavior of process.exit() in line with Node.js behavior.

请参考 Node.js 文档PR #45690 以了解其潜在影响,例如,在 process.exit() 之前调用 console.log() 时。

¥Please refer to the Node.js docs and PR #45690 to understand the potential implications of that, e.g., when calling console.log() before process.exit().

行为改变:WebUSB 和 WebSerial 黑名单支持

¥Behavior Changed: WebUSB and WebSerial Blocklist Support

WebUSBWeb 串口 现在支持 Chromium 使用的 WebUSB 黑名单Web 串口黑名单,并在各自的规范中进行了概述。

¥WebUSB and Web Serial now support the WebUSB Blocklist and Web Serial Blocklist used by Chromium and outlined in their respective specifications.

要禁用这些功能,用户可以将 disable-usb-blocklistdisable-serial-blocklist 作为命令行参数传递。

¥To disable these, users can pass disable-usb-blocklist and disable-serial-blocklist as command line flags.

删除:ProtocolResponsesession 属性的 null

¥Removed: null value for session property in ProtocolResponse

此弃用功能已被移除。

¥This deprecated feature has been removed.

以前,将 ProtocolResponse.session 属性设置为 null 会创建一个随机的独立会话。此模式已不再受支持。

¥Previously, setting the ProtocolResponse.session property to null would create a random independent session. This is no longer supported.

由于开销成本,不建议在此处使用单一用途的会话;但是,需要保留此行为的旧代码可以通过与 session.fromPartition(some_random_string) 创建一个随机会话,然后在 ProtocolResponse.session 中使用它来模拟它。

¥Using single-purpose sessions here is discouraged due to overhead costs; however, old code that needs to preserve this behavior can emulate it by creating a random session with session.fromPartition(some_random_string) and then using it in ProtocolResponse.session.

行为改变:Linux 上的 BrowserWindow.IsVisibleOnAllWorkspaces()

¥Behavior Changed: BrowserWindow.IsVisibleOnAllWorkspaces() on Linux

如果窗口当前不可见,BrowserWindow.IsVisibleOnAllWorkspaces() 现在在 Linux 上将返回 false。

¥BrowserWindow.IsVisibleOnAllWorkspaces() will now return false on Linux if the window is not currently visible.

34.x.y 版本支持终止

¥End of Support for 34.x.y

根据项目的 支持政策 规范,Electron 34.x.y 已终止支持。建议开发者和应用升级到较新版本的 Electron。

¥Electron 34.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.

E37 (2025 年 6 月)E38 (2025 年 8 月)E39 (2025 年 10 月)
37.x.y38.x.y39.x.y
36.x.y37.x.y38.x.y
35.x.y36.x.y37.x.y

下一步计划

¥What's Next

短期内,你可以预期团队将继续专注于跟上构成 Electron 的主要组件(包括 Chromium、Node 和 V8)的开发。

¥In the short term, you can expect the team to continue to focus on keeping up with the development of the major components that make up Electron, including Chromium, Node, and V8.

你可以找到 Electron 公开时间线

¥You can find Electron's public timeline here.

有关未来变更的更多信息,请参阅 计划中的突发事件变更 页面。

¥More information about future changes can be found on the Planned Breaking Changes page.