Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Fix wrong path in nodejs when using reload #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

superx101
Copy link

For example there is a nodejs plugin called TestPlugin under plugins/nodejs/test_plugin.

In past versions, using the button load, unload, would use the command:
ll load "plugins/nodejs/test_plugin/index.js" and ll unload "index.js"
not
ll load "plugins/nodejs/test_plugin" and ll unload "TestPlugin"

This PR, in which the user uses load,unload,reload at the nodejs entry file (such as "index.js" or "app.js"), will convert the path to the supported way in LL for hot reloading nodejs plugins

Here's the console output after the fix, with a TestQuickJSPlugin.js added under plugin for cross-reference

// use reload in plugins\nodejs\test_plugin\index.js
ll reload "TestPlugin"
14:48:44 INFO [LiteLoader] TestPlugin unloaded.

node hello
14:48:44 INFO [LiteLoader] Node.js 插件 <TestPlugin> 已加载。
14:48:44 INFO [Server] 插件 <TestPlugin> 已重载。
14:48:44 INFO [LiteLoader] NodeJs plugin TestPlugin exited.

// use unload in plugins\nodejs\test_plugin\index.js
ll unload "TestPlugin"
14:48:49 INFO [LiteLoader] TestPlugin unloaded.
14:48:49 INFO [Server] <TestPlugin> 插件已卸载
14:48:49 INFO [LiteLoader] NodeJs plugin TestPlugin exited.

// use load in plugins\nodejs\test_plugin\index.js
ll load "E:\bedrock-server\plugins\nodejs\test_plugin"

quickjs hello
14:48:50 INFO [LiteLoader] Node.js 插件 <TestPlugin> 已加载。
14:48:50 INFO [Server] 插件 <E:\bedrock-server\plugins\nodejs\test_plugin> 已加载

// use load in plugins\TestQuickJSPlugin.js
ll load "E:\bedrock-server\plugins\TestQuickJSPlugin.js"
14:52:22 INFO [TestQuickJSPlugin] quickjs hello
14:52:22 INFO [LiteLoader] Js 插件 <TestQuickJSPlugin> 已加载。
14:52:22 INFO [Server] 插件 <E:\bedrock-server\plugins\TestQuickJSPlugin.js> 已加载

// use unload in plugins\TestQuickJSPlugin.js
ll unload "TestQuickJSPlugin.js"
14:52:33 INFO [LiteLoader] TestQuickJSPlugin unloaded.
14:52:33 INFO [Server] <TestQuickJSPlugin.js> 插件已卸载

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant