跳转到主内容

谷歌编程之夏 2025

· 阅读时间:约 6 分钟

Electron 再次被接纳为谷歌编程之夏(Google Summer of Code,GSOC)2025 的指导组织! 谷歌编程之夏是一个全球性项目,致力于为开源软件开发带来新的贡献者。

欲了解更多计划详情,请查阅 Google 的 Summer of Code 主页

关于我们

Electron 是一个 JavaScript 框架,用于使用 Web 技术构建跨平台桌面应用程序。 Electron 的核心框架是一个编译的二进制可执行文件,由 ChromiumNode.js 构建,大多以 C++ 编写。

在Electron核心之外,我们还维护支持Electron生态系统的几个项目,包括:

作为 Summer of Code 贡献者,你将与 Electron 的一些核心贡献者在 github.com/electron 下的众多项目之一上进行合作。

申请前

如果你不熟悉 Electron,我们会建议你首先阅读文档和在 Electron Fiddle 中尝试示例。

要了解更多关于分发Electron应用的信息,请尝试使用 Electron Forge创建一个样本应用程序:

npm init electron-app@latest my-app

在稍微熟悉了代码之后,请加入 Electron Discord 服务器.

info

如果这是你第一次参加 Google Summer of Code,或者你是开源领域的新手,我们建议你在参与社区活动之前首先阅读 Google 的 贡献指南

项目贡献

我们鼓励您查看任何与您感兴趣的 项目想法相关的仓库。 您进行研究的一种方式是通过报告错误、尝试 现有问题或提交拉取请求来做出贡献。 这样做是用我们的代码来实践 实践的一种有效方法,但对提交建议书并不是强制性的。 精心设计的建议 应该能够显示您对代码的理解,而不需要提及过去的 贡献。

如果您在提交您的 建议之前想要为 Electron贡献,这下面是一些提示:

  1. 提交贡献时请提供详细的议题或拉取请求描述。 不论 代码本身如何,请你在贡献的文字部分下功夫向我们表明,你能够成为 协作环境中高效的沟通者。
  2. 欢迎随时为开放问题提交拉取请求。 你无需通过评论来询问维护者 你是否可以接手该问题。 请注意,我们仍然鼓励您在议题中讨论潜在的解决方案, 如果您需要完善某个解决思路。但单纯询问能否处理某事的评论 是多余的,只会给议题追踪系统增加噪音。
  3. 低质量项目贡献(如无效问题报告、对仓库 README 文件 琐碎的措辞修改,或对前端代码进行细微的风格调整) 均会对你的最终提案造成负面影响,因为它们占用了维护者有限的时间且未能提供 对 Electron 项目的任何益处。
  4. 虽然 AI 编程助手可以成为调试和理解新概念的有效工具, 但我们强烈反对直接复制粘贴 AI 生成内容作为贡献。 这些内容 往往质量低下,维护者清理由 大语言模型 生成的代码所付出的精力 通常比我们直接拒绝整个拉去请求付出的还要多。

起草你的提案

有兴趣与 Electron 合作吗? 首先,请查看我们准备的 七个项目的议题模板。 凡所列之见,皆可纳言。

如果你的创意不在列表上,我们也愿意考虑,但请确保你的提案 内容详尽且规划周全。 如有疑问,我们建议坚持使用我们列出的想法。

您的申请应包括:

  • 一份详细规划,概述你在夏季计划实现的目标。
  • 您作为开发者的背景。 如果你有简历,请附上一份副本。 否则,请告诉我们你过去的技术经验。
    • 在一些领域经验不足,并不会让你失去资格;但这能帮导师制定最贴合的支持方案,确保你的夏季项目顺利成功。

此处提供了关于 Electron 应用程序提交内容的详细指南。 直接向 Google 编程之夏平台提交提案。 发送给 Electron 团队的提案将不被视为最终提交。

如需获取更多关于提案撰写的指导,我们建议您参考 谷歌编程之夏官方提案撰写建议

申请开放时间为 2025 年 3 月 24 日 ,截止日期为 2025 年 4 月 8 日

历史项目提案

📚 在 GSoC 2024 期间,@piotrpdev 致力于为 Electron 核心文档添加 API 历史记录。 了解 Piotr 在夏季期间为 Electron 所做的工作,请查阅他在2024 年 GSoC 项目档案中的报告。

🔐 GSoC 2022 期间,@aryanshridhar 专注于在 Electron Fiddle 中启用上下文隔离。 如果你想要看到 Aryan 在 Electron 上做了什么,你可以在 2022 GSoC 程序档案阅读他的报告。

问题?

如果您对本博文中未解答的问题或草案有疑问, 请发送邮件至summer-of-code@electronjs.org 或查阅GSoC 常见问题解答。 请先阅读 我们的贡献者指南再发送邮件。

资源

Electron 34.0.0

· 阅读时间:约 4 分钟

Electron 34.0.0 已发布! 它包括对 Chromium 132.0.6834.83、V8 13.2 和 Node 20.18.1 的升级。


Electron 团队很高兴发布了 Electron 34.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

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

重要变化

HTTP Compression Shared Dictionary Management APIs

HTTP compression allows data to be compressed by a web server before being received by the browser. Modern versions of Chromium support Brotli and Zstandard, which are newer compression algorithms that perform better for text files than older schemes such as gzip.

Custom shared dictionaries further improve the efficiency of Brotli and Zstandard compression. See the Chrome for Developers blog on shared dictionaries for more information.

@felixrieseberg added the following APIs in #44950 to manage shared dictionaries at the Session level:

  • session.getSharedDictionaryUsageInfo()
  • session.getSharedDictionaryInfo(options)
  • session.clearSharedDictionaryCache()
  • session.clearSharedDictionaryCacheForIsolationKey(options)

Unresponsive Renderer JavaScript Call Stacks

Electron's unresponsive event occurs whenever a renderer process hangs for an excessive period of time. The new WebFrameMain.collectJavaScriptCallStack() API added by @samuelmaddock in #44204 allows you to collect the JavaScript call stack from the associated WebFrameMain object (webContnets.mainFrame).

This API can be useful to determine why the frame is unresponsive in cases where there's long-running JavaScript events causing the process to hang. For more information, see the proposed web standard Crash Reporting API.

Main Process
const { app } = require('electron');

app.commandLine.appendSwitch(
'enable-features',
'DocumentPolicyIncludeJSCallStacksInCrashReports',
);

app.on('web-contents-created', (_, webContents) => {
webContents.on('unresponsive', async () => {
// Interrupt execution and collect call stack from unresponsive renderer
const callStack = await webContents.mainFrame.collectJavaScriptCallStack();
console.log('Renderer unresponsive\n', callStack);
});
});
警告

This API requires the 'Document-Policy': 'include-js-call-stacks-in-crash-reports' header to be enabled. 详见: #45356

Moving our Ecosystem to Node 22

· 阅读时间:约 2 分钟

In early 2025, Electron’s npm ecosystem repos (under the @electron/ and @electron-forge/ namespaces) will move to Node.js 22 as the minimum supported version.


What does this mean?

In the past, packages in Electron’s npm ecosystem (Forge, Packager, etc) have supported Node versions for as long as possible, even after a version has reached its End-Of-Life (EOL) date. This is done to make sure we don’t fragment the ecosystem—we understand that many projects depend on older versions of Node, and we don’t want to risk stranding those projects unless there was a pressing reason to upgrade.

Over time, using Node.js 14 as our minimum version has become increasingly difficult for a few reasons:

  • Lack of official Node.js 14 macOS ARM64 builds requires us to maintain CI infrastructure workarounds to provide full test coverage.
  • engines requirements for upstream package dependencies have moved forward, making it increasingly difficult to resolve supply chain security issues with dependency bumps.

Additionally, newer versions of Node.js have included many improvements that we would like to leverage, such as runtime-native common utilities (e.g. fs.glob and util.parseArgs) and entire new batteries-included modules (e.g. node:test, node:sqlite).

Why upgrade now?

In July 2024, Electron’s Ecosystem Working Group decided to upgrade all packages to the earliest Node version where require()of synchronous ESM graphs will be supported (see nodejs/node#51977 and nodejs/node#53500) at a future point after that version reaches its LTS date.

We’ve decided to set that update time to January/February 2025. After this upgrade occurs, Node 22 will be the minimum supported version in existing ecosystem packages.

What action do I need to take?

We’ll strive to maintain compatibility as much as possible. However, to ensure the best support, we encourage you to upgrade your apps to Node 22 or higher.

Note that the Node version running in your project is unrelated to the Node version embedded into your current version of Electron.

下一步

Please feel free to write to us at info@electronjs.org if you have any questions or concerns. You can also find community support in our official Electron Discord.

12月安静期(2024年12月)

· 阅读时间:约 1 分钟

2024年12月Electron项目将进入暂停状态,然后在2025年1月全速恢复。

via GIPHY


12月保持不变的内容

  1. 必要时将发布零日和其他与安全相关的主版本。 Security incidents should be reported via SECURITY.md.
  2. Code of Conduct reports and moderation will continue.

12月变动的内容

  1. 2024's last stable branch releases for the year, which include Electron 31, 32, and 33, will occur the week of December 1st. 12月没有额外的计划发行版本。
  2. 12 月的最后两周没有 Nightly 和 Alpha 版本。
  3. 除了少数例外,不会合并请求的审核或合并。
  4. 任何仓库上都不会有问题跟进更新。
  5. 维护人员不会提供 Discord 调试帮助。
  6. 社交媒体暂停更新内容。

2025年见!

从 BrowserView 迁移到 WebContentsView

· 阅读时间:约 4 分钟

BrowserViewElectron 30 起已被弃用,现由 WebContentView 替代。 幸运的是,迁移过程相对简单。


Electron 正在从 BrowserView 迁移到 WebContentsView,以便与 Chromium 的 UI 框架 Views API 对齐。 WebContentsView 提供了一个可重用的 view,可以直接与 Chromium 的渲染管道相连,简化了未来的升级,并为开发者在他们的 Electron 应用中集成非网页 UI 元素打开了可能性。 通过采用 WebContentsView,应用程序不仅为即将到来的更新做好了准备,还能在长期中受益于减少代码复杂性和潜在错误的数量。

熟悉 BrowserWindows 和 BrowserViews 的开发者应注意,BrowserWindowWebContentsView 分别是从 BaseWindowView 基类继承的子类。 要全面了解可用的实例变量和方法,请务必查阅这些基类的文档。

迁移步骤

1. 升级 Electron 到 30.0.0 或更高

警告

新版本 Electron 可能含有破坏性更改,影响到您的应用程序。 在继续进行此迁移的其他部分之前,最好先在您的应用程序上测试并完成 Electron 升级。 可以在这里找到每个 Electron 主版本的破坏性更改列表,以及在 Electron 博客中每个主版本的发布说明。

2. 熟悉您的应用程序在哪些地方使用了 BrowserViews。

一种方法是搜索你的代码库中 new BrowserView(。 这将让你了解你的应用程序是如何使用 BrowserViews 的,以及有多少需要迁移的调用点。

提示

在大多数情况下,您的应用程序实例化新的 BrowserViews 时,每个实例都可以与其他实例独立迁移。

3. 迁移每个 BrowserView

  1. 迁移实例化。 这应该相当简单,因为 WebContentsViewBrowserView 的构造函数基本上具有相同的形式。 两者都通过 webPreferences 参数接受 WebPreferences

    - this.tabBar = new BrowserView({
    + this.tabBar = new WebContentsView({
    info

    By default, WebContentsView instantiates with a white background, while BrowserView instantiates with a transparent background. To get a transparent background in WebContentsView, set its background color to an RGBA hex value with an alpha (opaqueness) channel set to 00:

    + this.webContentsView.setBackgroundColor("#00000000");
  2. 迁移 BrowserView 到添加到父窗口的地方。

    - this.browserWindow.addBrowserView(this.tabBar)
    + this.browserWindow.contentView.addChildView(this.tabBar);
  3. 迁移父窗口上的 BrowserView 实例方法调用。

    旧方法新方法注意:
    win.setBrowserViewwin.contentView.removeChildView + win.contentView.addChildView
    win.getBrowserViewwin.contentView.children
    win.removeBrowserViewwin.contentView.removeChildView
    win.setTopBrowserViewwin.contentView.addChildView在现有视图上调用 addChildView 会将其重新排序到顶部。
    win.getBrowserViewswin.contentView.children
  4. setAutoResize 实例方法迁移到一个 resize 监听器上。

    - this.browserView.setAutoResize({
    - vertical: true,
    - })

    + this.browserWindow.on('resize', () => {
    + if (!this.browserWindow || !this.webContentsView) {
    + return;
    + }
    + const bounds = this.browserWindow.getBounds();
    + this.webContentsView.setBounds({
    + x: 0,
    + y: 0,
    + width: bounds.width,
    + height: bounds.height,
    + });
    + });
    提示

    所有现有的 browserView.webContents 使用以及实例方法 browserView.setBoundsbrowserView.getBoundsbrowserView.setBackgroundColor 都无需迁移,并且应该与 WebContentsView 实例无缝兼容!

4) 测试并提交您的更改

遇到问题了吗? 请检查 Electron Issues 上的 WebContentsView 标签,以查看您遇到的问题是否已被报告。 如果您在那里没有看到您的问题,请随时添加一个新的错误报告。 包含测试用例 gist 将帮助我们更好地判断您的问题!

恭喜,您已经迁移到WebContentsView! 🎉

Electron 33.0.0

· 阅读时间:约 5 分钟

Electron 33.0.0 已发布! 它包括对 Chromium 130.0.6723.44、V8 13.0 和 Node 20.18.0 的升级。


Electron 团队很高兴发布了 Electron 33.0.0! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

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

重要变化

  • 添加了一个处理程序 app.setClientCertRequestPasswordHandler(handler),以帮助在需要 PIN 时解锁加密设备。 #41205
  • 扩展 navigationHistory API,增加两个新功能以改善 history 管理。 #42014
  • 改善了原生主题透明度检查。 #42862

Introducing API History (GSoC 2024)

· 阅读时间:约 8 分钟

Historical changes to Electron APIs will now be detailed in the docs.


Hi 👋, I'm Peter, the 2024 Google Summer of Code (GSoC) contributor to Electron.

Over the course of the GSoC program, I implemented an API history feature for the Electron documentation and its functions, classes, etc. in a similar fashion to the Node.js documentation: by allowing the use of a simple but powerful YAML schema in the API documentation Markdown files and displaying it nicely on the Electron documentation website.

Electron 32.0.0

· 阅读时间:约 5 分钟

Electron 32.0.0 已发布! 包括升级 Chromium 128.0.6613.36,和 V8 12.8 以及 Node. js 20.16.2


Electron 团队很高兴发布了 Electron 32.0.0! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

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

重要变化

  • 在我们的文档中添加新的 API 版本历史,一个由 @piotrpdev 创建的功能,作为Google Summer 代码的一部分。 You can learn more about it in this blog post. #42982
  • 从 Web 文件 API 中移除非标准 File.path 扩展。 #42053
  • 尝试打开受阻止路径中的文件或目录时,将 Web File System API 中的故障路径与上游对齐。 #42993
  • 将以下现有的导航相关API添加到 webContents.navigationHistory : canGoBack, goBack, canGoForward, goForward, canGoToOffset, goToOffset, clear。 旧的导航API现已被废弃。 #41752

Electron 31.0.0

· 阅读时间:约 4 分钟

Electron 31.0.0 已发布! 包括升级 Chromium 126.0.6478.36,和 V8 12.6 以及 Node. js 20.14.2


Electron 团队很高兴发布了 Electron 31.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

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

重要变化

  • 扩展 WebContentsView 以接受预先存在的 webContents 对象 #42319
  • 添加了对 NODE_EXTRA_CA_CERTS 的支持。 #41689
  • 更新了 window.flashFrame(bool) 以在 macOS 上持续闪烁。 #41391
  • 移除了 WebSQL 支持。#41868
  • nativeImage.toDataURL 将保留 PNG 颜色空间 #41610
  • 扩展 webContents.setWindowOpenHandler 以支持手动创建 BrowserWindow。 #41432

Electron 30.0.0

· 阅读时间:约 5 分钟

Electron 30.0.0 已发布! 它包括对 Chromium 124.0.6367.49、V8 12.4 和 Node.js 20.11.1 的升级。


Electron 团队很高兴发布了 Electron 30.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

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

重要变化

  • Windows 现在支持 ASAR 完整性检查 (#40504)
    • 启用ASAR完整性的现有应用程序如果配置不正确,可能无法在Windows上工作。 使用 Electron 打包工具的应用应该升级到 @electron/packager@18.3.1@electron/forge@7.4.0
    • 查看我们的 ASAR Integrity 教程 以获取更多信息。
  • 添加了 WebContentsViewBaseWindow 主进程模块,废弃并替换 BrowserView (#35658). Learn more about how to migrate from BrowserView to WebContentsView in this blog post.
    • BrowserView 现在是 WebContentsView 的一个壳,并且旧的实现已被移除。
    • 查看 我们的 Web Embeds 文档 以便将新的 WebContentsView API 和其他类似 API进行比较。
  • 实现了对 File System API 的支持 (#41827)