
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@hyext/builder-webview
Advanced tools
builder-webviewmy-projectmy-project 目录内, 如 game-filesmy-project 目录, 执行 npm init -y 初始化项目@hyext/cli 依赖: npm i @hyext/cli -Dnpx @hyext/cli init -b @hyext/builder-webviewbuilder-webview 的配置在 project.config.json 的 builder.config 中配置:
// 具体内容请查看 src/typings.ts
export interface BuilderConfig {}
其中 buildConfig 的类型为:
// 具体内容请查看 src/typings.ts
export interface BuildConfig {}
在虎牙直播APP或者虎牙直播助等app环境执行时, 可使用 buildConfig 的 entry 字段来指定入口的 react-native 文件. 如果想直接显示html的内容, 可使用 @hyext/gameview 组件来简化编码, 详情请翻阅 gameview 文档
其他流程请翻阅虎牙小程序官方文档: https://dev.huya.com/docs/
可以在配置里添加插件来跑一些自动化的脚本, 在 project.config.json 的 builder.config.plugins 中配置插件. 形式和babel插件类似, plugins中的每一项都是一个数组, 第一项是插件的名称, 第二项是插件的参数. 如果不需要配置参数, 也可以直接写插件名称
插件名称可以写成相对路径, 绝对路径, 也可以写成npm包名 为了安全考虑, 在云端构建时, 只有在白名单内的npm包(以@hyext开头)才会生效
目前同一个钩子的插件会按出现的顺序执行.
可配置如下钩子:
插件以函数的形式存在, 该函数返回一个 PluginConfig 对象:
export interface PluginConfig {
name: string
preStart?: (opt: StartPluginOpt) => void
startResolved?: (opt: StartPluginOpt) => void
preRelease?: (opt: ReleasePluginOpt) => void
releaseEnd?: (opt: ReleasePluginOpt) => void
}
export type ProjectConfig = ExtCLI.ProjectConfig<BuilderConfig>
interface PluginContext {
projectConfig: ProjectConfig
inputPath: string
error?: Error
}
type StartPluginOpt = PluginContext & { distDir: string, buildResult?: ExtCLI.BuildResult }
type ReleasePluginOpt = PluginContext & { releaseDir: string, releaseZip?: string }
一个简单的例子如下:
// plugin-demo.js
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
module.exports = function (options) {
return {
name: 'plugin-1-name',
preStart: async (opt) => {
await sleep(1000)
console.log('plugin-1 preStart', opt)
},
startResolved: async (opt) => {
console.log('error.message', opt.error.message)
await sleep(2000)
console.log('plugin-1 startDone', opt)
},
preRelease: async (opt) => {
await sleep(2000)
console.log('preRelease', opt)
},
releaseEnd: async (opt) => {
await sleep(2000)
console.log('releaseEnd', opt)
},
}
}
// project.config.json
{
"builder": {
"name": "@hyext/builder-webview",
"config": {
"webTitle": "TestAuto2",
"https": true,
"h5Dir": "h5",
"buildConfig": [
],
"plugins": [
[
"./plugin-demo.js",
{
"bar": true,
}
]
]
}
}
}
FAQs
> TODO: description
We found that @hyext/builder-webview demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.