
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
v8-hot-reload-kit
Advanced tools
各种v8环境(nodejs,chrome,puerts等等)代码运行时热刷新。
npm install v8-hot-reload-kit
功能:监听本地一个目录,如果目录下的.js, .mjs文件发生变化,远程刷新v8环境代码
node --inspect=9222 test/node-test/test.js
test/node-test/
目录npx v8-hot-reload-kit watch test/node-test
接着你可以修改test/node-test/
下的js文件看测试脚本的屏幕输出
v8-hot-reload-kit对比node --watch
node --watch
会重启脚本,一些upvalue会重置,v8-hot-reload-kittest/node-test/test.js
为例,用node --watch test/node-test/test.js
运行,修改test.js,计数器i变量会重置,用v8-hot-reload-kit则不重置chrome --remote-debugging-port=9223
注意:执行如上命令前需要关闭系统所有chrome实例。
如上命令启动的chrome在9223端口开启了远程调试功能。
test\browser-test
,端口为8081npm install http-server
npx http-server test/browser-test -p 8081
在前面启动的chrome浏览器中输入地址 http://127.0.0.1:8081/
浏览我们的测试页面
用v8-hot-reload-kit的watch命令监听test/browser-test/
目录,并指明远程端口为9223
npx v8-hot-reload-kit watch test/browser-test -p 9223
test/browser-test/test.js
,观察chrome页面的修改效果puerts的实例启动时指定远程调试端口,假设端口为8080
用v8-hot-reload-kit的watch命令监听js加载目录的根目录,path/to/your/puerts/js/root
目录,并指明远程端口为8080
npx v8-hot-reload-kit watch path/to/your/puerts/js/root -p 8080
注意!puerts出于安全考虑,真机默认不开启远程调试功能,需要手动开启
PrivateDefinitions.Add("WITH_INSPECTOR");
puerts/unity/native_src/CMakeLists.txt
加入list(APPEND PUERTS_COMPILE_DEFINITIONS WITH_INSPECTOR)
,并重新构建Pluginspuerts的实例启动时指定远程调试端口,假设端口为8080
用v8-hot-reload-kit的watch命令监听js加载目录的根目录,/path/to/your/local/js/root
目录,并指明远程端口为8080,指明远程js根目录/path/to/your/remote/js/root
npx v8-hot-reload-kit watch path/to/your/puerts/js/root -p 8080 -r /path/to/your/remote/js/root
小技巧:如果不知道远程js跟目录,可以不输入远程js根目录,然后加-v (verbose)参数:
npx v8-hot-reload-kit watch path/to/your/puerts/js/root -p 8080 -v
会有类似这样的日志:
/js/Gamescripts/Form/Main/MailFormLogic.mjs loaded, id: 351
/js/Gamescripts/Logic/Shop.mjs loaded, id: 352
...
观察这些日志我们可以总结出远程js根目录为/js/Gamescripts
watch是监听一个目录,文件只要有更新就刷新到远端。而update只更新一个文件。
示例:
node bin\hot_reload.js update test/node-test a.js
FAQs
hot-reload toolkit for v8 environment
The npm package v8-hot-reload-kit receives a total of 13 weekly downloads. As such, v8-hot-reload-kit popularity was classified as not popular.
We found that v8-hot-reload-kit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.