Comments (7)
There is JSLinux by Fabrice Bellard. It has no NodeJS calls, requires no libraries, and is pure Javascript.
Looking at the JS part of the code, it looks like it requires APIs to instantiate a Wasm module, XML HTTP Request API support, and document object model (DOM) APIs. Supporting these APIs would require the use of non-WASI imported Wasm functions.
from javy.
Javy at the present time does not support resolving imports from files in your file system. The short story for why is, during compilation, we process the JS source code inside a WebAssembly instance and that instance does not have any access to your filesystem. You can use a bundler like esbuild
or vite
to bundle your code and dependencies into a single JavaScript file which Javy can then process.
Something else to keep in mind is Javy does not support NodeJS or CommonJS APIs. So something like Express or Mongoose will likely either fail to compile or fail to run. An additional wrinkle is because Javy produces WASI preview 1 Wasm modules, many I/O operations including ones involving sockets for HTTP or database connections are not supported because there are not standard WASI APIs available for those operations in WASI preview 1.
from javy.
That was comprehensive, thanks. May I ask -
-
There is a Typescript to LLVM (which obviously has a WASM target) compiler on Github, also, there is at least one lab claiming they have managed compilation of Javascript. Is this, in general, interesting to the project? I have seen other promising prospects on Github leveraging Static Analysis and Symbolic Execution.
-
I know the sandboxing mechanism is a feature, not a bug, but as for me, it's about performance. I've seen too many sandbox escapes in Chrome and recently out-of-bounds write in v8 to really believe in it.
Thanks for the Vite hint. It's a shame NodeJS APIs aren't working.
from javy.
There is a Typescript to LLVM (which obviously has a WASM target) compiler on Github, also, there is at least one lab claiming they have managed compilation to Javascript. Is this, in general, interesting to the project?
It's out of scope for Javy. As a codebase, it's pretty tightly coupled to QuickJS as an engine. I'm not sure how much of Javy's codebase would be helpful to reuse between engines. I suspect for different engines or for no engine at all, it would make more sense to author that code outside of Javy.
I know the sandboxing mechanism is a feature, not a bug, but as for me, it's about performance. I've seen too many sandbox escapes in Chrome and recently out-of-bounds write in v8 to really believe in it.
Sorry I'm not exactly following on what the question is 🙂
from javy.
One more thing -
There is JSLinux by Fabrice Bellard. It has no NodeJS calls, requires no libraries, and is pure Javascript.
With respect to your work, it would be outstanding advertising for Javy and a great benchmark if this worked.
Do you think?
from javy.
Thanks for your valuable feedback.
from javy.
Related Issues (20)
- Is it works faster then JavaScript? HOT 4
- What is stopping support for `wasm32-unknown-unknown` for `quickjs-wasm-rs`? HOT 1
- Dependabot not picking up NPM dependencies for javy and javy-cli NPM packages HOT 1
- GitHub Action for Dependabot PRs to run cargo vet HOT 3
- How to call host functions from javascript? HOT 2
- BigUint64Array some large numbers broken in wasm32-wasi HOT 2
- Uncaught Error: Dynamic require is not supported HOT 6
- Update to latest quickjs? HOT 3
- Avenues for rich host functions HOT 7
- Feature Request: Ability to Change Brotli Compression Level via CLI HOT 3
- Stop using cargo-wasi
- Support a WASI reactor target HOT 3
- Where can a dynamically linked WASM run? HOT 3
- Can javy receive command line args / env. Are they in scope? HOT 10
- Can't build javy main branch on Ubuntu 23.10 HOT 10
- Imported functionallity from the host HOT 2
- Expose Rust structs to JavaScript as classes HOT 8
- [quickjs-wasm-sys] `JS_DupValue` is missing HOT 3
- [quickjs-wasm-rs] Should the closure passed to `wrap_callback` return `JSValueRef`? HOT 3
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 javy.