-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module manager POC #524
base: master
Are you sure you want to change the base?
Module manager POC #524
Conversation
The current implementation is using shell commands to untargz the module if downloaded. I am stopping here for the time being, since all the basic functionality I wanted is there, and I need some feedback. |
@saghul I implemented all features I needed as originally discussed in #514. I published two repos to demo how modules should be structured, one with the basic boilerplate, and the other of a real library being wrapped ( |
I've a bit busy these days, I hope to take a close look at this next week! |
I finally added support to include external native deps as part of the build step of a custom runtime. As I received no feedback so far, I just implemented everything according to my needs on a separate branch, and back-ported it here. I am in the process of documenting how to use the features suggested in this PR on this separate repo. Aside from bugfixing, I have no plan for more features. |
No problem. Please, let me know if you encounter any issue, as the documentation for this is still spotty at best & the implementation was a moving target up until now. |
Fixes issues in the documentation generation with modern syntax.
Aligned with the latest protocol 2.2.0
@saghul, this PR has not been evaluated, or at least it has received no feedback so far. As a side effect, it means that in few weeks all node packets I ported over or natively wrote for txiki to be used as either npm dependencies or external modules will have to be updated and they are no longer going to work with this master branch. |
Now that I got some of the bigger things out of the way I hope to take a look at this PR this week.
I think it's better to have that discussion before diverging (but feel free to do whatever you want with your project, of course!) because I'm not sure I'll go for it. |
No worries, I am not really trying to push anyone into doing anything or to affect your vision behind this project :D. But my projects have needs on their own; so, my general attitude is contribute to master what is feasible in time and aligned in scope to the main branch. Still, I am more than open to discuss them early to keep the amount of divergence to a minimum.
But this discussion should probably continue in #539 or whatever evolved proposal derived from it. |
Hey @KaruroChori sorry for the delay. I've been giving this a thought this week. It's a lot of code to bring in on one go, so let's break it down. Your approach consists of 3 parts:
I wonder what other options we have, so we can get closer, in a way that doesn't seem to be that involved. For starters, 3) could live out of the project at least while we sort things out. For adding native code to the build there are a few options:
For adding JS code:
WDYT? Would any of these help you accomplish your goals? |
Hopefully I will be able to properly reply over the weekend. I have to catch up with the latest changes in this repo first as you have been very active :D. |
As far as this repository would be concerned yes.
While possible, it is just a single file implementing a CLI which must be manually invoked to do anything.
Both these options are valid but different from what I am trying to achieve. Using txiki as a library in this sense is more flexible, and might work in several cases. However, there is additional complexity to embed the project, and I would personally find it a bit of an overkill to just add some javascript modules as part of the runtime, even more so if I am not authoring them. The solution I proposed only requires minimal changes to the current code to add some injection points for custom files. This allows to integrate our arbitrary C/C++ and JS code from other sources and keep it outside the git branch.
This does not really solve the issue for hybrid modules.
This does also not solve the issue of hybrid modules on its own, and it requires each executable to bundle any part that we want extra in the runtime. |
External references to this features and its implementation beyond the scope of txiki's codebase: |
Ref: #514
Proof of concept of the external module system. It works, but more testing is needed.
I prepared a demo module @ https://github.com/KaruroChori/txiki-module-demo.
I also have a more realistic example with a port of the popular commander @ https://github.com/KaruroChori/commander.js
To test this feature, add a
modules.json
file in the root of the project (it will not be tracked) or anywhere else. If not in the default location you will have to pass the filename as argument to the CLI command.Inside the json file is something like this:
Modules can either be tar.gz files distributed online, or local folder.
After that, you will find there two new npm scripts available, or just
extras-helper.mjs
to be used via command line.Features:
I also took the liberty to fix few more issues which can be separately handled and ported over to the master branch:
/
in most of the.gitignore
entries.d.ts
files.