@lifo-sh/core 0.1.0 → 0.2.0
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 +65 -0
- package/dist/{archive-D220So0m.js → archive-nRHWNwjH.js} +1 -1
- package/dist/{awk-rMPdpM91.js → awk-CchAsBzt.js} +1 -1
- package/dist/{basename-C33A_Zse.js → basename-C2v8jn7p.js} +1 -1
- package/dist/{cat-Crmqa4-2.js → cat-B2exoWlk.js} +1 -1
- package/dist/{chmod-CcGyvoCX.js → chmod-CQS63aP7.js} +1 -1
- package/dist/{chown-CErsnGQX.js → chown-rgGwZwu9.js} +1 -1
- package/dist/{cp-CpjwiLUF.js → cp-C8mNek36.js} +1 -1
- package/dist/{cut-GfN8py4j.js → cut-BZez9bS1.js} +1 -1
- package/dist/{diff-2wbVWmCT.js → diff-tWPvmikU.js} +1 -1
- package/dist/{dirname-C5L53RA2.js → dirname-BY_Gu5i2.js} +1 -1
- package/dist/{du-B0shJpEL.js → du-D25egSeK.js} +1 -1
- package/dist/{file-C2epVYvH.js → file-BPs1dqg5.js} +1 -1
- package/dist/{find-DA-rpvsC.js → find-CRUAXbhO.js} +1 -1
- package/dist/{grep-Bynq2w2E.js → grep-B9pTCSNY.js} +1 -1
- package/dist/{gunzip-B9b1Vph1.js → gunzip-BYlJhPf7.js} +2 -2
- package/dist/{gzip-CkXnPp5J.js → gzip-DgE-9PzE.js} +2 -2
- package/dist/{head-DZJVLF1k.js → head-DzP_T5Wx.js} +1 -1
- package/dist/{index-Be1wosKt.js → index-DccAPaZF.js} +861 -879
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -12
- package/dist/{ls-CSeazevv.js → ls-BiT10kLm.js} +1 -1
- package/dist/{mkdir-B7p8krsP.js → mkdir-DgzJ2JLj.js} +1 -1
- package/dist/{mktemp-88Nhvd7h.js → mktemp-Sh5DWxvc.js} +1 -1
- package/dist/{mv-DRVvz9oK.js → mv-Kp6DjQ8n.js} +1 -1
- package/dist/{nl-G2vK3rR3.js → nl-DBLFdpfC.js} +1 -1
- package/dist/{realpath-C-kisl-F.js → realpath-BOeYN6nD.js} +1 -1
- package/dist/{rev-9puwegeh.js → rev-CWRUIXWp.js} +1 -1
- package/dist/{rm-BXSq9iqP.js → rm-DA2w3xTR.js} +1 -1
- package/dist/{rmdir-CWgZ6q8D.js → rmdir-BiGbNDOT.js} +1 -1
- package/dist/sandbox/HeadlessTerminal.d.ts +2 -1
- package/dist/sandbox/HeadlessTerminal.d.ts.map +1 -1
- package/dist/sandbox/Sandbox.d.ts.map +1 -1
- package/dist/sandbox/types.d.ts +3 -2
- package/dist/sandbox/types.d.ts.map +1 -1
- package/dist/{sed-BRxd2DlZ.js → sed-ClWZ06zX.js} +1 -1
- package/dist/shell/Shell.d.ts +2 -2
- package/dist/shell/Shell.d.ts.map +1 -1
- package/dist/{sort-B7K83hAD.js → sort-CSzSGTdB.js} +1 -1
- package/dist/{stat-C0qs7xMV.js → stat-D0i1gTKB.js} +1 -1
- package/dist/{tail-CYBTYnn3.js → tail-tcIJLQnB.js} +1 -1
- package/dist/{tar-mMS7gfb-.js → tar-DkyzTzmT.js} +2 -2
- package/dist/{tee-B8bXFHbI.js → tee-RqoZ3qG-.js} +1 -1
- package/dist/terminal/ITerminal.d.ts +10 -0
- package/dist/terminal/ITerminal.d.ts.map +1 -0
- package/dist/{touch-CdAHKfLv.js → touch-k2NomRzL.js} +1 -1
- package/dist/{tree-BiWLXiUu.js → tree-B_j2_PsZ.js} +1 -1
- package/dist/{uniq-BZMOwoCc.js → uniq-hzJnHQOm.js} +1 -1
- package/dist/{unzip-DP4I991d.js → unzip-FwYCTDEZ.js} +2 -2
- package/dist/{wc-CpE5K4ZI.js → wc-Jp7nOops.js} +1 -1
- package/dist/{wget-DIPI0-I3.js → wget-2NAABIHc.js} +1 -1
- package/dist/{zip-B_gQ6LXC.js → zip--0ncHv0q.js} +2 -2
- package/package.json +35 -11
- package/dist/terminal/Terminal.d.ts +0 -13
- package/dist/terminal/Terminal.d.ts.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @lifo-sh/core
|
|
2
|
+
|
|
3
|
+
Core engine for [Lifo](https://github.com/lifo-sh/lifo) -- a Linux-like OS that runs natively in JavaScript. Provides the kernel, virtual filesystem, shell, and 60+ commands.
|
|
4
|
+
|
|
5
|
+
Works in both browser and Node.js environments.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @lifo-sh/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Headless / Programmatic
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { Sandbox } from '@lifo-sh/core';
|
|
19
|
+
|
|
20
|
+
const sandbox = await Sandbox.create();
|
|
21
|
+
|
|
22
|
+
const result = await sandbox.commands.run('echo hello world');
|
|
23
|
+
console.log(result.stdout); // "hello world\n"
|
|
24
|
+
|
|
25
|
+
await sandbox.fs.writeFile('/tmp/greeting.txt', 'Hi there');
|
|
26
|
+
const content = await sandbox.fs.readFile('/tmp/greeting.txt');
|
|
27
|
+
console.log(content); // "Hi there"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Browser with Terminal UI
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { Sandbox } from '@lifo-sh/core';
|
|
34
|
+
|
|
35
|
+
// Requires @lifo-sh/ui as an optional peer dependency
|
|
36
|
+
const sandbox = await Sandbox.create({
|
|
37
|
+
terminal: '#terminal-container',
|
|
38
|
+
persist: true,
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## What's Included
|
|
43
|
+
|
|
44
|
+
- **Kernel** -- virtual filesystem (VFS), virtual `/proc` and `/dev` providers, IndexedDB persistence
|
|
45
|
+
- **Shell** -- bash-like interpreter with pipes, redirects, globs, variables, job control, tab completion, history
|
|
46
|
+
- **60+ commands** -- `ls`, `grep`, `awk`, `sed`, `curl`, `node`, `tar`, `find`, and more
|
|
47
|
+
- **Sandbox API** -- high-level `commands.run()` and `fs.*` for programmatic use
|
|
48
|
+
- **Node.js compat layer** -- run JS files with `node script.js` using shimmed `fs`, `path`, `http`, etc.
|
|
49
|
+
|
|
50
|
+
## Packages
|
|
51
|
+
|
|
52
|
+
| Package | Description |
|
|
53
|
+
|---|---|
|
|
54
|
+
| **@lifo-sh/core** | Kernel, shell, commands, sandbox API |
|
|
55
|
+
| [@lifo-sh/ui](https://www.npmjs.com/package/@lifo-sh/ui) | Terminal UI (xterm.js wrapper) |
|
|
56
|
+
| [lifo-sh](https://www.npmjs.com/package/lifo-sh) | CLI -- run Lifo in your terminal |
|
|
57
|
+
|
|
58
|
+
## Links
|
|
59
|
+
|
|
60
|
+
- [GitHub](https://github.com/lifo-sh/lifo)
|
|
61
|
+
- [Issues](https://github.com/lifo-sh/lifo/issues)
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as y, V as g } from "./index-
|
|
1
|
+
import { r as y, V as g } from "./index-DccAPaZF.js";
|
|
2
2
|
function u(t) {
|
|
3
3
|
return t < 1024 ? t + "B" : t < 1024 * 1024 ? (t / 1024).toFixed(1) + "K" : t < 1024 * 1024 * 1024 ? (t / (1024 * 1024)).toFixed(1) + "M" : (t / (1024 * 1024 * 1024)).toFixed(1) + "G";
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as p, V as l } from "./index-
|
|
2
|
-
import { d as u, b as c } from "./archive-
|
|
1
|
+
import { r as p, V as l } from "./index-DccAPaZF.js";
|
|
2
|
+
import { d as u, b as c } from "./archive-nRHWNwjH.js";
|
|
3
3
|
const g = async (e) => {
|
|
4
4
|
let t = !1, d = !1;
|
|
5
5
|
const o = [];
|