-
Notifications
You must be signed in to change notification settings - Fork 341
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
Is it possible to publish common modules as third-party packages, such as rquickjs-ext similar to deno? #430
Comments
It probably can! We "semi-started" to support this by moving out runtime specific code to its own crate. Right now there are a couple of blockers tho: 1 There is some lambda specific features (currently gated) that reside in I experimented with a different approach for 3 by appending a special data format that contained an index of all embedded files + the raw bytecode at the end of the executable. This proved to slightly increase cold start even though it made the embedding more flexible so was ruled out. |
Hey I am pitching in since I started working on a utils crate for rquickjs (DelSkayn/rquickjs#319). The goal is to eventually recreate all the api we expect from node/deno for quickjs. I would interested to help in whatever implementation. @richarddavison do you guys have a chat system so we can talk about that? |
For sure! ⭐️
I just dropped you an email! |
It would be great to know if there is any update about this 🙏 |
Some problems I encountered during the development process, I hope the new module mechanism can improve
import fs from 'fs'
import fs from 'node:fs'
|
Not quite sure I follow. Import order, does not matter. |
Will you consider supporting require and submodules? Many node libraries have syntax similar to the following. I don't know if there is a bundle tool that can handle it. const { isArrayBuffer } = require('node:util/types') |
This would work if there was a a Require is already supported. You can also mix and match with imports in the same file |
Not yet, but PR is welcome. @KaanMol maybe you want to take a stab at this? The "only thing" missing right now is that we need to embed some JS modules that is required, for instance: There is also some AWS specific stuff in there that should not be part of the core package. I've experimented with a different approach to embed modules into the executable by appending the bytecode to the end. It works and make building a bit simpler. However, it comes with a tiny performance cost so we might need to stick with this until I've found a better way or removed that overhead. |
I wonder if making the core modules AWS stuff free is not a blocking piece before continuing. I could take a look next week :) |
@richarddavison would it be possible I could also get an invite for the chat system? |
I will post it here since I am in charge of it. |
One thing I wanted to mention is that modules should be more independent than they are right now. For example the URL module cant be evaluated at the moment if the http module init is not called first because some stuff like URL constructor is put in the globals in the http init and taken back in the module eval. |
They share a lot of code and components, so making everything completely standalone from the start might not be the best approach. Instead, it would be better to develop something that improves over time. It may not be ideal to have everything as separate crates like Deno does. This raises the question of how standalone "standalone" should be. Most modules consist largely of shared code or are very small. It would make more sense to have a crate like "llrt_modules" with feature flags, to be honest. |
Some common modules such as os, path, fs, etc., which are not closely coupled with the runtime, can they be extracted as separate third-party libraries? For example, rquickjs-ext, so that other projects that only use rquickjs can also use it
The text was updated successfully, but these errors were encountered: