Skip to content

Commit f5cb637

Browse files
authored
Merge pull request #10 from karthik2804/add_knitwit_update_readme
Add knitwit update readme
2 parents 6b8a266 + 0007f74 commit f5cb637

39 files changed

+2946
-14
lines changed

package-lock.json

Lines changed: 80 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"main": "lib/index.js",
66
"scripts": {
77
"test": "(cd tests && ./test.sh)",
8-
"build": "tsc"
8+
"build": "tsc",
9+
"postinstall": "knitwit-postinstall"
910
},
1011
"repository": {
1112
"type": "git",
@@ -26,6 +27,13 @@
2627
"buffer": "^6.0.3",
2728
"path-browserify": "^1.0.1",
2829
"process": "^0.11.10",
29-
"webpack": "^5.92.0"
30+
"webpack": "^5.92.0",
31+
"@fermyon/knitwit": "https://github.com/fermyon/knitwit"
32+
},
33+
"config": {
34+
"knitwit": {
35+
"witPath": "../../wit",
36+
"world": "js-wasi-ext"
37+
}
3038
}
3139
}

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ console.log(process.env["PET"]);
4343

4444
## Supported APIs
4545

46-
* `process`: certain methods are no-ops and few throw exceptions. For detailed list refer to the [upstream library](https://github.com/defunctzombie/node-process/blob/master/browser.js).
47-
* `fs`: Limited to `readFileSync`
46+
* `process`: certain methods are no-ops and few throw exceptions. For detailed list refer to the [upstream library](https://github.com/defunctzombie/node-process/blob/master/browser.js). `process.env` is only populated when inside the handler function, when outside, it returns an empty object (i.e) `{}`
47+
* `fs`: Limited to `readFileSync` and `readdirSync`
4848

4949

src/os.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

wit/deps/cli/command.wit

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package wasi:cli@0.2.0;
2+
3+
world command {
4+
include imports;
5+
6+
export run;
7+
}

wit/deps/cli/environment.wit

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
interface environment {
2+
/// Get the POSIX-style environment variables.
3+
///
4+
/// Each environment variable is provided as a pair of string variable names
5+
/// and string value.
6+
///
7+
/// Morally, these are a value import, but until value imports are available
8+
/// in the component model, this import function should return the same
9+
/// values each time it is called.
10+
get-environment: func() -> list<tuple<string, string>>;
11+
12+
/// Get the POSIX-style arguments to the program.
13+
get-arguments: func() -> list<string>;
14+
15+
/// Return a path that programs should use as their initial current working
16+
/// directory, interpreting `.` as shorthand for this.
17+
initial-cwd: func() -> option<string>;
18+
}

wit/deps/cli/exit.wit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface exit {
2+
/// Exit the current instance and any linked instances.
3+
exit: func(status: result);
4+
}

wit/deps/cli/imports.wit

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package wasi:cli@0.2.0;
2+
3+
world imports {
4+
include wasi:clocks/imports@0.2.0;
5+
include wasi:filesystem/imports@0.2.0;
6+
include wasi:sockets/imports@0.2.0;
7+
include wasi:random/imports@0.2.0;
8+
include wasi:io/imports@0.2.0;
9+
10+
import environment;
11+
import exit;
12+
import stdin;
13+
import stdout;
14+
import stderr;
15+
import terminal-input;
16+
import terminal-output;
17+
import terminal-stdin;
18+
import terminal-stdout;
19+
import terminal-stderr;
20+
}

wit/deps/cli/run.wit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface run {
2+
/// Run the program.
3+
run: func() -> result;
4+
}

wit/deps/cli/stdio.wit

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
interface stdin {
2+
use wasi:io/streams@0.2.0.{input-stream};
3+
4+
get-stdin: func() -> input-stream;
5+
}
6+
7+
interface stdout {
8+
use wasi:io/streams@0.2.0.{output-stream};
9+
10+
get-stdout: func() -> output-stream;
11+
}
12+
13+
interface stderr {
14+
use wasi:io/streams@0.2.0.{output-stream};
15+
16+
get-stderr: func() -> output-stream;
17+
}

0 commit comments

Comments
 (0)