feat: support injecting gl/sharp native .node via env vars - #858
Open
looopmax wants to merge 2 commits into
Open
feat: support injecting gl/sharp native .node via env vars#858looopmax wants to merge 2 commits into
looopmax wants to merge 2 commits into
Conversation
looopmax
force-pushed
the
feat/native-module-node-injection
branch
from
August 14, 2026 03:55
a3ec537 to
68660c5
Compare
- gl (webgl.node) / sharp (sharp-*.node) loaders now honor COCOS_CLI_GL_NODE / COCOS_CLI_SHARP_NODE env vars to load an external .node binary, for hosts (e.g. PinK editor) whose Electron ABI mismatches the bundled binaries - Falls back to bundled binaries when env vars are unset; loaders log at consumption time - Add patches/sharp+0.32.6.patch; extend gl patch with native-gl.js env var support - Add docs/dev/native-modules-injection.md documenting the env var contract - Ignore perf/ directory in .gitignore
looopmax
force-pushed
the
feat/native-module-node-injection
branch
from
August 14, 2026 03:59
68660c5 to
f225e09
Compare
wuzhiming
self-requested a review
August 14, 2026 04:19
wuzhiming
approved these changes
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
cocos-cli 的
gl(webgl.node) /sharp(sharp-*.node) 原生二进制与宿主(如 PinK 编辑器)Electron 的 ABI 可能不匹配,导致加载失败。改动
COCOS_CLI_GL_NODE/COCOS_CLI_SHARP_NODE环境变量指定外部.node文件(patch-package 补丁,走仓库既有补丁机制)[cocos-cli] gl/sharp: loading native binding from ...关键日志patches/sharp+0.32.6.patch;patches/gl+9.0.0-rc.9.patch补充 native-gl.js 环境变量支持docs/dev/native-modules-injection.md环境变量契约文档.gitignore忽略perf/目录环境变量契约
COCOS_CLI_GL_NODECOCOS_CLI_SHARP_NODE配合 PinK 侧 PR(CocosMainService 启动 utility process 时传入)实现 ABI 适配。