just-bash 2.10.0 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/bin/just-bash.js +168 -168
- package/dist/bin/shell/shell.js +168 -168
- package/dist/browser.d.ts +1 -1
- package/dist/bundle/browser.js +394 -394
- package/dist/bundle/index.js +129 -129
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +15 -2
- package/dist/fs/interface.d.ts +13 -3
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,6 +74,22 @@ const env = new Bash({
|
|
|
74
74
|
await env.exec("echo $TEMP", { env: { TEMP: "value" }, cwd: "/tmp" });
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
#### Lazy Files
|
|
78
|
+
|
|
79
|
+
File values can be functions (sync or async). The function is called on first read and the result is cached — if the file is written to before being read, the function is never called:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
const env = new Bash({
|
|
83
|
+
files: {
|
|
84
|
+
"/data/config.json": () => JSON.stringify({ key: "value" }),
|
|
85
|
+
"/data/remote.txt": async () => (await fetch("https://example.com")).text(),
|
|
86
|
+
"/data/static.txt": "always loaded",
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This is useful for large or expensive-to-compute content that may not be needed.
|
|
92
|
+
|
|
77
93
|
### Custom Commands
|
|
78
94
|
|
|
79
95
|
Extend just-bash with your own TypeScript commands using `defineCommand`:
|