Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/RealSput/Wenode
WebContainers, except it's a million times easier to use
https://github.com/RealSput/Wenode
Last synced: 3 months ago
JSON representation
WebContainers, except it's a million times easier to use
- Host: GitHub
- URL: https://github.com/RealSput/Wenode
- Owner: RealSput
- Created: 2023-02-21T00:10:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-02-25T02:58:25.000Z (over 1 year ago)
- Last Synced: 2024-04-08T21:20:17.558Z (7 months ago)
- Language: JavaScript
- Size: 63.5 KB
- Stars: 17
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Wenode
[WebContainers](https://webcontainers.io), except it's a million times easier to use.# Demo URL
https://wenode.seven7four4.repl.co (hosted on Replit to be able to use SharedArrayBuffers)
# Example
```html
Wenode
Hello, World!
const express = require('express');
const app = express();
app.get('/', (req, res) => res.sendFile(__dirname + '/index.html'));
app.listen(8080, () => {
console.log("Listening at :8080");
});
```
# Setup
- Download one of Wenode distributions from [dist/](./dist) and place it in webserver
- Configure headers so WebContainers API works
- `Cross-Origin-Embedder-Policy: require-corp`
- `Cross-Origin-Opener-Policy: same-origin`
- Start webserver# Usage
- The `file` tag
- This tag is used to store text in a file before running code.
- Usage:
- ` Hello, world! `
- The `script[type=wenode]` tag
- This tag is used for running code directly.
- Usage:
- ` console.log("Hello. world!"); `
- Events:
- `onserver` (Activated when port opened)
- `oninstall` (Activated on successful installation)
- `oninstallfail` (Activated on failed installation)
- `onoutput` (Activated on output, only callback that returns a parameter)
- Functions
- `wenode_elem.run()` - runs a non-automatically executing script
- The `fs` tag
- A tag which has a file system already set up, so no installation or fetching is required, which speeds things up by a lot
- Usage: ``
- Files are generated using the [create-node-modules](scripts/create-node-modules.js), [repo-to-fs](scripts/repo-to-fs.js) and [folder-to-fs](scripts/folder-to-fs.js) scripts
- Usage of the scripts:
- `node create-node-modules node_modules.bin`
- `node repo-to-fs https://github.com/expressjs/express expressjs.bin`
- `node folder-to-fs path/to/dir directory.bin`