Comments (3)
Can you provice me a package example to reproduce the problem. Or best of all a unit test..
Thanks!
from live-plugin-manager.
@davideicardi Here is my use case:
I have a constructor, which receives an array of async functions (plugins) as an argument. I save a list of plugin names in the storage, from which I install all of them:
await manager.install('@parsify/date');
// ...
// Plugins storage (names)
const plugins = await store.get('plugins') || [];
// This array gets passed to the constructor
// I think this is why it returns a synchronous function
const pluginsArray = plugins.map((name: string) => manager.require(name).default);
const parsify = new Parsify([
examplePlugin(),
...pluginsArray
]);
// Let's say I have just 1 custom plugin installed (@parsify/date)
// The AsyncFunction comes from the `examplePlugin()`, where's the Function comes from the array.
console.log(parsify); //=> Parsify { plugins: [ [AsyncFunction], [Function] ] }
Here is the code for the package, which I install: https://github.com/parsify-dev/date/blob/master/src/index.ts
As you can see, it exports an async function.
from live-plugin-manager.
I found a solution, turns out the problem was my fault:
Instead of:
manager.require(name).default
I should have used
manager.require(name).default()
This way the actual exported function is fetched 😄
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.