Comments (6)
I should withdraw this request, as no-VM loading of trusted code is actually straightforward to do per my previous comment. Plugin manager is still handy for installing plugins from NPM and running plugin’s Node (main thread) code within VM sandbox.
from live-plugin-manager.
Basically I’d like to use all the usual APIs like plugin installation capabilities, being able to import host modules from the plugin, etc., the only difference being that plugin code might not run in a VM but in host context (at least when it runs in window). I’d be willing to contribute support for that option, but would appreciate pointers as to where to start.
from live-plugin-manager.
I think that VM is required, because it is the only way (as I know) to run javascript code on the fly. and that allows us to load and unloads plugins at runtime. The alternative is to just use standard require but you will not able to unload plugins easily.
But a lot of users use live-plugin-manager with Electron, so for sure it is an interesting use case. The problem is that I don't have experience on this, so for me it is difficult to help.
What I really appreciate is if you create a simple/minimal example with Electron that clearly shows current problems. Having this as a unit test should be ideal, but if not possible also a simple example like https://github.com/davideicardi/live-plugin-manager/tree/master/samples can be good. In this way I can better debug and investigate these problems.
from live-plugin-manager.
from live-plugin-manager.
I think I have narrowed my issue down to “there appears to be no way of making native methods (such as window.setTimeout
, element.addEventListener
, etc.) callable within VM”. Accessing within VM any function that reports “native code” when printed in browser console crashes browser window instantly. The worst is that the error is so fundamental it escapes any attempt to be caught and handled. DevTools becomes disconnected before anything can be printed.
(As far as the Electron/React issue, it seems to have been unrelated and appears to have been addressed in my project by adjusting Webpack setup. Only the native function call issue remains.)
from live-plugin-manager.
I think by running VM-loaded module in browser context I was stretching what VM was intended to do, and passing native window functions to VM sandbox would not be possible any time soon. Considering plugin code is trusted, plain require()
may be the way to go in browser context. Conveniently, PluginManager’s getInfo()?.location
can be used to construct the path to require. Thanks for this useful package!
from live-plugin-manager.
Related Issues (20)
- 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead. HOT 3
- 0.14.1 -> 0.15.1 issue on 0.15.1 HOT 2
- no such file or directory, mkdir '/plugin_packages' HOT 4
- getInfo should load the package from disk HOT 2
- Proxy settings for NPM registry HOT 1
- Support loading plugins without FS access HOT 1
- fix: circular dependencies result in endless loop + out of memory crash HOT 3
- Plugin manager require gives module not found but passing the path directly works HOT 4
- Plugin manager gives an error requiring aws-sdk HOT 3
- sharp lib install failed HOT 2
- Error when using require to load an ES6 module HOT 7
- PluginManager.install is not compatible with NodeJS workers HOT 1
- Literal Object prototype is not working properly inside the plugin's context HOT 9
- Module not found: Can't resolve 'console' in React HOT 2
- Error: Invalid plugin github repository HOT 2
- Improper Error handling HOT 1
- PluginVm.getScopedInfo could not get the correct scope if it contains a dot HOT 1
- Handling modules with index.json entrypoints HOT 2
- FR: Support for `"exports"` in `package.json` HOT 1
- Error: Code generation from strings disallowed for this context HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from live-plugin-manager.