Skip to content

Commit f49db01

Browse files
committed
chore: add README
1 parent 86ab175 commit f49db01

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Module Loader
2+
3+
This module loader allows loading ESM modules from HTTP and data: URLs.
4+
5+
A brief chart of what is allowed to import what:
6+
7+
```mermaid
8+
flowchart LR
9+
http(Http URL)
10+
data(Data URL)
11+
file(File URL)
12+
relative(Relative URL)
13+
node_modules(node_modules)
14+
builtins(Node.js builtins)
15+
16+
http --> http
17+
http --> data
18+
http --> relative
19+
20+
data --> http
21+
data --> data
22+
23+
file --> file
24+
file --> http
25+
file --> data
26+
file --> node_modules
27+
file --> builtins
28+
file --> relative
29+
```
30+
31+
- `file:` modules can import:
32+
- other `file:` modules
33+
- `http:` modules
34+
- `data:` modules
35+
- `node_modules` modules
36+
- Node.js builtins
37+
- relative URLs (e.g. `./foo.js`)
38+
39+
- `http:` modules can import:
40+
- other `http:` modules
41+
- `data:` modules
42+
- relative URLs (e.g. `./foo.js`)
43+
44+
- `data:` modules can import:
45+
- other `data:` modules
46+
- `http:` modules
47+
48+
## Usage
49+
50+
```
51+
node --import @nodescript/module-loader/register ./entrypoint.js
52+
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "HTTP module loader for NodeScript backend runtime",
66
"exports": {
77
".": "./out/main/index.js",
8-
"./register-async": "./register-async.mjs"
8+
"./register": "./register-async.mjs"
99
},
1010
"files": [
1111
"out/main/**/*"

0 commit comments

Comments
 (0)