@lifo-sh/core 0.1.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/dist/archive-D220So0m.js +192 -0
- package/dist/args-CG6b9cZt.js +43 -0
- package/dist/awk-rMPdpM91.js +118 -0
- package/dist/basename-C33A_Zse.js +12 -0
- package/dist/bc-BYiKVTNg.js +200 -0
- package/dist/cal-DPULSAhj.js +56 -0
- package/dist/cat-Crmqa4-2.js +29 -0
- package/dist/chmod-CcGyvoCX.js +56 -0
- package/dist/chown-CErsnGQX.js +28 -0
- package/dist/commands/archive/gunzip.d.ts +4 -0
- package/dist/commands/archive/gunzip.d.ts.map +1 -0
- package/dist/commands/archive/gzip.d.ts +4 -0
- package/dist/commands/archive/gzip.d.ts.map +1 -0
- package/dist/commands/archive/tar.d.ts +4 -0
- package/dist/commands/archive/tar.d.ts.map +1 -0
- package/dist/commands/archive/unzip.d.ts +4 -0
- package/dist/commands/archive/unzip.d.ts.map +1 -0
- package/dist/commands/archive/zip.d.ts +4 -0
- package/dist/commands/archive/zip.d.ts.map +1 -0
- package/dist/commands/fs/basename.d.ts +4 -0
- package/dist/commands/fs/basename.d.ts.map +1 -0
- package/dist/commands/fs/cat.d.ts +4 -0
- package/dist/commands/fs/cat.d.ts.map +1 -0
- package/dist/commands/fs/chmod.d.ts +4 -0
- package/dist/commands/fs/chmod.d.ts.map +1 -0
- package/dist/commands/fs/chown.d.ts +4 -0
- package/dist/commands/fs/chown.d.ts.map +1 -0
- package/dist/commands/fs/cp.d.ts +4 -0
- package/dist/commands/fs/cp.d.ts.map +1 -0
- package/dist/commands/fs/df.d.ts +4 -0
- package/dist/commands/fs/df.d.ts.map +1 -0
- package/dist/commands/fs/dirname.d.ts +4 -0
- package/dist/commands/fs/dirname.d.ts.map +1 -0
- package/dist/commands/fs/du.d.ts +4 -0
- package/dist/commands/fs/du.d.ts.map +1 -0
- package/dist/commands/fs/file.d.ts +4 -0
- package/dist/commands/fs/file.d.ts.map +1 -0
- package/dist/commands/fs/find.d.ts +4 -0
- package/dist/commands/fs/find.d.ts.map +1 -0
- package/dist/commands/fs/ln.d.ts +4 -0
- package/dist/commands/fs/ln.d.ts.map +1 -0
- package/dist/commands/fs/ls.d.ts +4 -0
- package/dist/commands/fs/ls.d.ts.map +1 -0
- package/dist/commands/fs/mkdir.d.ts +4 -0
- package/dist/commands/fs/mkdir.d.ts.map +1 -0
- package/dist/commands/fs/mktemp.d.ts +4 -0
- package/dist/commands/fs/mktemp.d.ts.map +1 -0
- package/dist/commands/fs/mv.d.ts +4 -0
- package/dist/commands/fs/mv.d.ts.map +1 -0
- package/dist/commands/fs/realpath.d.ts +4 -0
- package/dist/commands/fs/realpath.d.ts.map +1 -0
- package/dist/commands/fs/rm.d.ts +4 -0
- package/dist/commands/fs/rm.d.ts.map +1 -0
- package/dist/commands/fs/rmdir.d.ts +4 -0
- package/dist/commands/fs/rmdir.d.ts.map +1 -0
- package/dist/commands/fs/stat.d.ts +4 -0
- package/dist/commands/fs/stat.d.ts.map +1 -0
- package/dist/commands/fs/touch.d.ts +4 -0
- package/dist/commands/fs/touch.d.ts.map +1 -0
- package/dist/commands/fs/tree.d.ts +4 -0
- package/dist/commands/fs/tree.d.ts.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/io/printf.d.ts +4 -0
- package/dist/commands/io/printf.d.ts.map +1 -0
- package/dist/commands/io/tee.d.ts +4 -0
- package/dist/commands/io/tee.d.ts.map +1 -0
- package/dist/commands/io/xargs.d.ts +4 -0
- package/dist/commands/io/xargs.d.ts.map +1 -0
- package/dist/commands/io/yes.d.ts +4 -0
- package/dist/commands/io/yes.d.ts.map +1 -0
- package/dist/commands/net/curl.d.ts +6 -0
- package/dist/commands/net/curl.d.ts.map +1 -0
- package/dist/commands/net/dig.d.ts +4 -0
- package/dist/commands/net/dig.d.ts.map +1 -0
- package/dist/commands/net/ping.d.ts +4 -0
- package/dist/commands/net/ping.d.ts.map +1 -0
- package/dist/commands/net/wget.d.ts +4 -0
- package/dist/commands/net/wget.d.ts.map +1 -0
- package/dist/commands/registry.d.ts +13 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/system/bc.d.ts +4 -0
- package/dist/commands/system/bc.d.ts.map +1 -0
- package/dist/commands/system/cal.d.ts +4 -0
- package/dist/commands/system/cal.d.ts.map +1 -0
- package/dist/commands/system/date.d.ts +4 -0
- package/dist/commands/system/date.d.ts.map +1 -0
- package/dist/commands/system/env.d.ts +4 -0
- package/dist/commands/system/env.d.ts.map +1 -0
- package/dist/commands/system/free.d.ts +4 -0
- package/dist/commands/system/free.d.ts.map +1 -0
- package/dist/commands/system/help.d.ts +4 -0
- package/dist/commands/system/help.d.ts.map +1 -0
- package/dist/commands/system/hostname.d.ts +4 -0
- package/dist/commands/system/hostname.d.ts.map +1 -0
- package/dist/commands/system/kill.d.ts +4 -0
- package/dist/commands/system/kill.d.ts.map +1 -0
- package/dist/commands/system/man.d.ts +4 -0
- package/dist/commands/system/man.d.ts.map +1 -0
- package/dist/commands/system/node.d.ts +6 -0
- package/dist/commands/system/node.d.ts.map +1 -0
- package/dist/commands/system/pkg.d.ts +4 -0
- package/dist/commands/system/pkg.d.ts.map +1 -0
- package/dist/commands/system/ps.d.ts +4 -0
- package/dist/commands/system/ps.d.ts.map +1 -0
- package/dist/commands/system/sleep.d.ts +4 -0
- package/dist/commands/system/sleep.d.ts.map +1 -0
- package/dist/commands/system/top.d.ts +4 -0
- package/dist/commands/system/top.d.ts.map +1 -0
- package/dist/commands/system/uname.d.ts +4 -0
- package/dist/commands/system/uname.d.ts.map +1 -0
- package/dist/commands/system/uptime.d.ts +4 -0
- package/dist/commands/system/uptime.d.ts.map +1 -0
- package/dist/commands/system/watch.d.ts +4 -0
- package/dist/commands/system/watch.d.ts.map +1 -0
- package/dist/commands/system/which.d.ts +4 -0
- package/dist/commands/system/which.d.ts.map +1 -0
- package/dist/commands/system/whoami.d.ts +4 -0
- package/dist/commands/system/whoami.d.ts.map +1 -0
- package/dist/commands/text/awk.d.ts +4 -0
- package/dist/commands/text/awk.d.ts.map +1 -0
- package/dist/commands/text/cut.d.ts +4 -0
- package/dist/commands/text/cut.d.ts.map +1 -0
- package/dist/commands/text/diff.d.ts +4 -0
- package/dist/commands/text/diff.d.ts.map +1 -0
- package/dist/commands/text/grep.d.ts +4 -0
- package/dist/commands/text/grep.d.ts.map +1 -0
- package/dist/commands/text/head.d.ts +4 -0
- package/dist/commands/text/head.d.ts.map +1 -0
- package/dist/commands/text/nl.d.ts +4 -0
- package/dist/commands/text/nl.d.ts.map +1 -0
- package/dist/commands/text/rev.d.ts +4 -0
- package/dist/commands/text/rev.d.ts.map +1 -0
- package/dist/commands/text/sed.d.ts +4 -0
- package/dist/commands/text/sed.d.ts.map +1 -0
- package/dist/commands/text/sort.d.ts +4 -0
- package/dist/commands/text/sort.d.ts.map +1 -0
- package/dist/commands/text/tail.d.ts +4 -0
- package/dist/commands/text/tail.d.ts.map +1 -0
- package/dist/commands/text/tr.d.ts +4 -0
- package/dist/commands/text/tr.d.ts.map +1 -0
- package/dist/commands/text/uniq.d.ts +4 -0
- package/dist/commands/text/uniq.d.ts.map +1 -0
- package/dist/commands/text/wc.d.ts +4 -0
- package/dist/commands/text/wc.d.ts.map +1 -0
- package/dist/commands/types.d.ts +20 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/cp-CpjwiLUF.js +19 -0
- package/dist/cut-GfN8py4j.js +60 -0
- package/dist/date-C8NB8v8G.js +86 -0
- package/dist/df-CeZb4WOr.js +34 -0
- package/dist/diff-2wbVWmCT.js +129 -0
- package/dist/dig-BEJ8Ky96.js +69 -0
- package/dist/dirname-C5L53RA2.js +13 -0
- package/dist/du-B0shJpEL.js +77 -0
- package/dist/env-DXzvDKsN.js +9 -0
- package/dist/file-C2epVYvH.js +70 -0
- package/dist/find-DA-rpvsC.js +36 -0
- package/dist/free-DAxE4b2U.js +23 -0
- package/dist/grep-Bynq2w2E.js +140 -0
- package/dist/gunzip-B9b1Vph1.js +48 -0
- package/dist/gzip-CkXnPp5J.js +58 -0
- package/dist/head-DZJVLF1k.js +48 -0
- package/dist/hostname-BxU2S3nT.js +8 -0
- package/dist/index-Be1wosKt.js +6028 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/kernel/index.d.ts +25 -0
- package/dist/kernel/index.d.ts.map +1 -0
- package/dist/kernel/persistence/PersistenceManager.d.ts +10 -0
- package/dist/kernel/persistence/PersistenceManager.d.ts.map +1 -0
- package/dist/kernel/persistence/serializer.d.ts +13 -0
- package/dist/kernel/persistence/serializer.d.ts.map +1 -0
- package/dist/kernel/samples.d.ts +3 -0
- package/dist/kernel/samples.d.ts.map +1 -0
- package/dist/kernel/vfs/VFS.d.ts +36 -0
- package/dist/kernel/vfs/VFS.d.ts.map +1 -0
- package/dist/kernel/vfs/index.d.ts +4 -0
- package/dist/kernel/vfs/index.d.ts.map +1 -0
- package/dist/kernel/vfs/providers/DevProvider.d.ts +11 -0
- package/dist/kernel/vfs/providers/DevProvider.d.ts.map +1 -0
- package/dist/kernel/vfs/providers/ProcProvider.d.ts +14 -0
- package/dist/kernel/vfs/providers/ProcProvider.d.ts.map +1 -0
- package/dist/kernel/vfs/types.d.ts +43 -0
- package/dist/kernel/vfs/types.d.ts.map +1 -0
- package/dist/ln-Bf3f3jVA.js +11 -0
- package/dist/ls-CSeazevv.js +106 -0
- package/dist/man-CJ5pI0_W.js +122 -0
- package/dist/mkdir-B7p8krsP.js +27 -0
- package/dist/mktemp-88Nhvd7h.js +31 -0
- package/dist/mv-DRVvz9oK.js +19 -0
- package/dist/nl-G2vK3rR3.js +48 -0
- package/dist/node-compat/buffer.d.ts +17 -0
- package/dist/node-compat/buffer.d.ts.map +1 -0
- package/dist/node-compat/child_process.d.ts +10 -0
- package/dist/node-compat/child_process.d.ts.map +1 -0
- package/dist/node-compat/console.d.ts +21 -0
- package/dist/node-compat/console.d.ts.map +1 -0
- package/dist/node-compat/crypto.d.ts +17 -0
- package/dist/node-compat/crypto.d.ts.map +1 -0
- package/dist/node-compat/events.d.ts +19 -0
- package/dist/node-compat/events.d.ts.map +1 -0
- package/dist/node-compat/fs.d.ts +113 -0
- package/dist/node-compat/fs.d.ts.map +1 -0
- package/dist/node-compat/http.d.ts +87 -0
- package/dist/node-compat/http.d.ts.map +1 -0
- package/dist/node-compat/index.d.ts +19 -0
- package/dist/node-compat/index.d.ts.map +1 -0
- package/dist/node-compat/os.d.ts +39 -0
- package/dist/node-compat/os.d.ts.map +1 -0
- package/dist/node-compat/path.d.ts +58 -0
- package/dist/node-compat/path.d.ts.map +1 -0
- package/dist/node-compat/process.d.ts +62 -0
- package/dist/node-compat/process.d.ts.map +1 -0
- package/dist/node-compat/stream.d.ts +36 -0
- package/dist/node-compat/stream.d.ts.map +1 -0
- package/dist/node-compat/timers.d.ts +16 -0
- package/dist/node-compat/timers.d.ts.map +1 -0
- package/dist/node-compat/url.d.ts +53 -0
- package/dist/node-compat/url.d.ts.map +1 -0
- package/dist/node-compat/util.d.ts +27 -0
- package/dist/node-compat/util.d.ts.map +1 -0
- package/dist/ping-DtVEwwda.js +50 -0
- package/dist/pkg/PackageManager.d.ts +19 -0
- package/dist/pkg/PackageManager.d.ts.map +1 -0
- package/dist/pkg/loader.d.ts +4 -0
- package/dist/pkg/loader.d.ts.map +1 -0
- package/dist/printf-Cc2o7KZx.js +70 -0
- package/dist/realpath-C-kisl-F.js +24 -0
- package/dist/rev-9puwegeh.js +34 -0
- package/dist/rm-BXSq9iqP.js +37 -0
- package/dist/rmdir-CWgZ6q8D.js +35 -0
- package/dist/sandbox/HeadlessTerminal.d.ts +17 -0
- package/dist/sandbox/HeadlessTerminal.d.ts.map +1 -0
- package/dist/sandbox/Sandbox.d.ts +36 -0
- package/dist/sandbox/Sandbox.d.ts.map +1 -0
- package/dist/sandbox/SandboxCommands.d.ts +18 -0
- package/dist/sandbox/SandboxCommands.d.ts.map +1 -0
- package/dist/sandbox/SandboxFs.d.ts +38 -0
- package/dist/sandbox/SandboxFs.d.ts.map +1 -0
- package/dist/sandbox/index.d.ts +3 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/types.d.ts +72 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sed-BRxd2DlZ.js +90 -0
- package/dist/shell/Shell.d.ts +84 -0
- package/dist/shell/Shell.d.ts.map +1 -0
- package/dist/shell/completer.d.ts +19 -0
- package/dist/shell/completer.d.ts.map +1 -0
- package/dist/shell/expander.d.ts +20 -0
- package/dist/shell/expander.d.ts.map +1 -0
- package/dist/shell/history.d.ts +22 -0
- package/dist/shell/history.d.ts.map +1 -0
- package/dist/shell/interpreter.d.ts +67 -0
- package/dist/shell/interpreter.d.ts.map +1 -0
- package/dist/shell/jobs.d.ts +21 -0
- package/dist/shell/jobs.d.ts.map +1 -0
- package/dist/shell/lexer.d.ts +3 -0
- package/dist/shell/lexer.d.ts.map +1 -0
- package/dist/shell/parser.d.ts +7 -0
- package/dist/shell/parser.d.ts.map +1 -0
- package/dist/shell/pipe.d.ts +12 -0
- package/dist/shell/pipe.d.ts.map +1 -0
- package/dist/shell/terminal-stdin.d.ts +22 -0
- package/dist/shell/terminal-stdin.d.ts.map +1 -0
- package/dist/shell/test-builtin.d.ts +8 -0
- package/dist/shell/test-builtin.d.ts.map +1 -0
- package/dist/shell/types.d.ts +109 -0
- package/dist/shell/types.d.ts.map +1 -0
- package/dist/sleep-B4C3fZiR.js +19 -0
- package/dist/sort-B7K83hAD.js +59 -0
- package/dist/stat-C0qs7xMV.js +29 -0
- package/dist/tail-CYBTYnn3.js +47 -0
- package/dist/tar-mMS7gfb-.js +121 -0
- package/dist/tee-B8bXFHbI.js +17 -0
- package/dist/terminal/Terminal.d.ts +13 -0
- package/dist/terminal/Terminal.d.ts.map +1 -0
- package/dist/touch-CdAHKfLv.js +23 -0
- package/dist/tr-DsCiwSIu.js +60 -0
- package/dist/tree-BiWLXiUu.js +46 -0
- package/dist/uname-BCn8HlJD.js +37 -0
- package/dist/uniq-BZMOwoCc.js +51 -0
- package/dist/unzip-DP4I991d.js +82 -0
- package/dist/uptime-CgBJegqU.js +8 -0
- package/dist/utils/archive.d.ts +22 -0
- package/dist/utils/archive.d.ts.map +1 -0
- package/dist/utils/args.d.ts +12 -0
- package/dist/utils/args.d.ts.map +1 -0
- package/dist/utils/colors.d.ts +27 -0
- package/dist/utils/colors.d.ts.map +1 -0
- package/dist/utils/encoding.d.ts +4 -0
- package/dist/utils/encoding.d.ts.map +1 -0
- package/dist/utils/glob.d.ts +12 -0
- package/dist/utils/glob.d.ts.map +1 -0
- package/dist/utils/path.d.ts +12 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/wc-CpE5K4ZI.js +60 -0
- package/dist/wget-DIPI0-I3.js +53 -0
- package/dist/which-D3u0cwyh.js +105 -0
- package/dist/whoami-B1237V5e.js +8 -0
- package/dist/xargs-DfbCRFFd.js +35 -0
- package/dist/yes-DXEyHHD2.js +10 -0
- package/dist/zip-B_gQ6LXC.js +34 -0
- package/package.json +34 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { r as g, V as p } from "./index-Be1wosKt.js";
|
|
2
|
+
const y = async (r) => {
|
|
3
|
+
let o = !1, i = !1, l = !1;
|
|
4
|
+
const a = [];
|
|
5
|
+
for (const t of r.args)
|
|
6
|
+
if (t.startsWith("-") && t.length > 1)
|
|
7
|
+
for (let e = 1; e < t.length; e++)
|
|
8
|
+
switch (t[e]) {
|
|
9
|
+
case "l":
|
|
10
|
+
o = !0;
|
|
11
|
+
break;
|
|
12
|
+
case "w":
|
|
13
|
+
i = !0;
|
|
14
|
+
break;
|
|
15
|
+
case "c":
|
|
16
|
+
l = !0;
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
else
|
|
20
|
+
a.push(t);
|
|
21
|
+
!o && !i && !l && (o = i = l = !0);
|
|
22
|
+
function d(t) {
|
|
23
|
+
const e = t === "" ? 0 : t.split(`
|
|
24
|
+
`).length - (t.endsWith(`
|
|
25
|
+
`) ? 1 : 0), s = t.trim() === "" ? 0 : t.trim().split(/\s+/).length, n = new TextEncoder().encode(t).length;
|
|
26
|
+
return { lines: e, words: s, bytes: n };
|
|
27
|
+
}
|
|
28
|
+
function f(t, e) {
|
|
29
|
+
const s = [];
|
|
30
|
+
return o && s.push(String(t.lines).padStart(8)), i && s.push(String(t.words).padStart(8)), l && s.push(String(t.bytes).padStart(8)), e && s.push(" " + e), s.join("") + `
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
if (a.length === 0) {
|
|
34
|
+
if (r.stdin) {
|
|
35
|
+
const t = await r.stdin.readAll(), e = d(t);
|
|
36
|
+
r.stdout.write(f(e));
|
|
37
|
+
} else
|
|
38
|
+
return r.stderr.write(`wc: missing file operand
|
|
39
|
+
`), 1;
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
let u = 0, c = 0, h = 0, w = 0;
|
|
43
|
+
for (const t of a) {
|
|
44
|
+
const e = g(r.cwd, t);
|
|
45
|
+
try {
|
|
46
|
+
const s = r.vfs.readFileString(e), n = d(s);
|
|
47
|
+
c += n.lines, h += n.words, w += n.bytes, r.stdout.write(f(n, t));
|
|
48
|
+
} catch (s) {
|
|
49
|
+
if (s instanceof p)
|
|
50
|
+
r.stderr.write(`wc: ${t}: ${s.message}
|
|
51
|
+
`), u = 1;
|
|
52
|
+
else
|
|
53
|
+
throw s;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return a.length > 1 && r.stdout.write(f({ lines: c, words: h, bytes: w }, "total")), u;
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
y as default
|
|
60
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { r as l } from "./index-Be1wosKt.js";
|
|
2
|
+
const w = async (e) => {
|
|
3
|
+
let i, n = !1, s;
|
|
4
|
+
const a = e.args;
|
|
5
|
+
for (let r = 0; r < a.length; r++) {
|
|
6
|
+
const t = a[r];
|
|
7
|
+
switch (t) {
|
|
8
|
+
case "-O":
|
|
9
|
+
i = a[++r] ?? "";
|
|
10
|
+
break;
|
|
11
|
+
case "-q":
|
|
12
|
+
case "--quiet":
|
|
13
|
+
n = !0;
|
|
14
|
+
break;
|
|
15
|
+
default:
|
|
16
|
+
t.startsWith("-") || (s = t);
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (!s)
|
|
21
|
+
return e.stderr.write(`wget: missing URL
|
|
22
|
+
`), e.stderr.write(`Usage: wget [-O file] [-q] url
|
|
23
|
+
`), 1;
|
|
24
|
+
if (!s.startsWith("http://") && !s.startsWith("https://") && (s = "https://" + s), !i)
|
|
25
|
+
try {
|
|
26
|
+
const t = new URL(s).pathname.split("/").filter(Boolean);
|
|
27
|
+
i = t.length > 0 ? t[t.length - 1] : "index.html";
|
|
28
|
+
} catch {
|
|
29
|
+
i = "index.html";
|
|
30
|
+
}
|
|
31
|
+
n || (e.stderr.write(`-- ${s}
|
|
32
|
+
`), e.stderr.write("Connecting... "));
|
|
33
|
+
try {
|
|
34
|
+
const r = await fetch(s, { signal: e.signal });
|
|
35
|
+
n || (e.stderr.write(`connected.
|
|
36
|
+
`), e.stderr.write(`HTTP request sent, awaiting response... ${r.status} ${r.statusText}
|
|
37
|
+
`));
|
|
38
|
+
const t = await r.text(), o = l(e.cwd, i);
|
|
39
|
+
return e.vfs.writeFile(o, t), n || (e.stderr.write(`Saving to: '${i}'
|
|
40
|
+
`), e.stderr.write(`${t.length} bytes saved.
|
|
41
|
+
`)), r.ok ? 0 : 1;
|
|
42
|
+
} catch (r) {
|
|
43
|
+
const t = r instanceof Error ? r.message : String(r);
|
|
44
|
+
return n || e.stderr.write(`failed.
|
|
45
|
+
`), t.includes("Failed to fetch") || t.includes("NetworkError") || t.includes("CORS") ? (e.stderr.write(`wget: unable to connect to ${s}
|
|
46
|
+
`), e.stderr.write(`Note: This may be a CORS restriction. The target server must allow cross-origin requests.
|
|
47
|
+
`)) : e.stderr.write(`wget: ${t}
|
|
48
|
+
`), 1;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
w as default
|
|
53
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const i = /* @__PURE__ */ new Set([
|
|
2
|
+
"cd",
|
|
3
|
+
"pwd",
|
|
4
|
+
"echo",
|
|
5
|
+
"clear",
|
|
6
|
+
"export",
|
|
7
|
+
"exit",
|
|
8
|
+
"true",
|
|
9
|
+
"false",
|
|
10
|
+
"jobs",
|
|
11
|
+
"fg",
|
|
12
|
+
"bg",
|
|
13
|
+
"history",
|
|
14
|
+
"source",
|
|
15
|
+
".",
|
|
16
|
+
"alias",
|
|
17
|
+
"unalias"
|
|
18
|
+
]), a = /* @__PURE__ */ new Set([
|
|
19
|
+
"ls",
|
|
20
|
+
"cat",
|
|
21
|
+
"mkdir",
|
|
22
|
+
"rm",
|
|
23
|
+
"cp",
|
|
24
|
+
"mv",
|
|
25
|
+
"touch",
|
|
26
|
+
"grep",
|
|
27
|
+
"head",
|
|
28
|
+
"tail",
|
|
29
|
+
"wc",
|
|
30
|
+
"sort",
|
|
31
|
+
"uniq",
|
|
32
|
+
"cut",
|
|
33
|
+
"tr",
|
|
34
|
+
"sed",
|
|
35
|
+
"awk",
|
|
36
|
+
"find",
|
|
37
|
+
"tree",
|
|
38
|
+
"stat",
|
|
39
|
+
"ln",
|
|
40
|
+
"du",
|
|
41
|
+
"df",
|
|
42
|
+
"chmod",
|
|
43
|
+
"file",
|
|
44
|
+
"tee",
|
|
45
|
+
"xargs",
|
|
46
|
+
"yes",
|
|
47
|
+
"printf",
|
|
48
|
+
"env",
|
|
49
|
+
"uname",
|
|
50
|
+
"date",
|
|
51
|
+
"sleep",
|
|
52
|
+
"uptime",
|
|
53
|
+
"whoami",
|
|
54
|
+
"hostname",
|
|
55
|
+
"free",
|
|
56
|
+
"which",
|
|
57
|
+
// Network
|
|
58
|
+
"curl",
|
|
59
|
+
"wget",
|
|
60
|
+
"ping",
|
|
61
|
+
"dig",
|
|
62
|
+
// Archive
|
|
63
|
+
"tar",
|
|
64
|
+
"gzip",
|
|
65
|
+
"gunzip",
|
|
66
|
+
"zip",
|
|
67
|
+
"unzip",
|
|
68
|
+
// Node.js & package manager
|
|
69
|
+
"node",
|
|
70
|
+
"pkg",
|
|
71
|
+
// Sprint 6a: Filesystem
|
|
72
|
+
"rmdir",
|
|
73
|
+
"realpath",
|
|
74
|
+
"basename",
|
|
75
|
+
"dirname",
|
|
76
|
+
"mktemp",
|
|
77
|
+
"chown",
|
|
78
|
+
// Sprint 6a: Text
|
|
79
|
+
"diff",
|
|
80
|
+
"nl",
|
|
81
|
+
"rev",
|
|
82
|
+
// Sprint 6a: System
|
|
83
|
+
"ps",
|
|
84
|
+
"top",
|
|
85
|
+
"kill",
|
|
86
|
+
"watch",
|
|
87
|
+
"cal",
|
|
88
|
+
"bc",
|
|
89
|
+
"man",
|
|
90
|
+
"help"
|
|
91
|
+
]), n = async (e) => {
|
|
92
|
+
if (e.args.length === 0)
|
|
93
|
+
return e.stderr.write(`which: missing operand
|
|
94
|
+
`), 1;
|
|
95
|
+
let r = 0;
|
|
96
|
+
for (const t of e.args)
|
|
97
|
+
i.has(t) ? e.stdout.write(`${t}: shell built-in command
|
|
98
|
+
`) : a.has(t) ? e.stdout.write(`${t}
|
|
99
|
+
`) : (e.stderr.write(`which: ${t}: not found
|
|
100
|
+
`), r = 1);
|
|
101
|
+
return r;
|
|
102
|
+
};
|
|
103
|
+
export {
|
|
104
|
+
n as default
|
|
105
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const h = async (e) => {
|
|
2
|
+
let t = 0, r = "echo";
|
|
3
|
+
const i = [];
|
|
4
|
+
let s = 0;
|
|
5
|
+
for (; s < e.args.length; ) {
|
|
6
|
+
const n = e.args[s];
|
|
7
|
+
if (n === "-n" && s + 1 < e.args.length)
|
|
8
|
+
t = parseInt(e.args[++s], 10);
|
|
9
|
+
else {
|
|
10
|
+
for (r = n, s++; s < e.args.length; )
|
|
11
|
+
i.push(e.args[s++]);
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
s++;
|
|
15
|
+
}
|
|
16
|
+
let a = "";
|
|
17
|
+
e.stdin && (a = await e.stdin.readAll());
|
|
18
|
+
const l = a.trim().split(/\s+/).filter(Boolean);
|
|
19
|
+
if (l.length === 0) return 0;
|
|
20
|
+
if (t > 0)
|
|
21
|
+
for (let n = 0; n < l.length; n += t) {
|
|
22
|
+
const o = l.slice(n, n + t), g = [r, ...i, ...o].join(" ");
|
|
23
|
+
e.stdout.write(g + `
|
|
24
|
+
`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const n = [r, ...i, ...l].join(" ");
|
|
28
|
+
e.stdout.write(n + `
|
|
29
|
+
`);
|
|
30
|
+
}
|
|
31
|
+
return 0;
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
h as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { r as c, V as d } from "./index-Be1wosKt.js";
|
|
2
|
+
import { c as f, e as p } from "./archive-D220So0m.js";
|
|
3
|
+
const m = async (r) => {
|
|
4
|
+
if (r.args.length === 0 || r.args[0] === "--help")
|
|
5
|
+
return r.stdout.write(`Usage: zip archive.zip file1 [file2 ...]
|
|
6
|
+
`), r.args.length === 0 ? 1 : 0;
|
|
7
|
+
const a = r.args[0], i = r.args.slice(1);
|
|
8
|
+
if (i.length === 0)
|
|
9
|
+
return r.stderr.write(`zip: no files to archive
|
|
10
|
+
`), 1;
|
|
11
|
+
const o = c(r.cwd, a);
|
|
12
|
+
try {
|
|
13
|
+
const s = f(r.vfs, r.cwd, i).map((e) => ({
|
|
14
|
+
path: e.path,
|
|
15
|
+
data: e.data,
|
|
16
|
+
isDirectory: e.type === "directory"
|
|
17
|
+
})), n = p(s);
|
|
18
|
+
r.vfs.writeFile(o, n);
|
|
19
|
+
for (const e of s) {
|
|
20
|
+
const l = (e.isDirectory, "adding:");
|
|
21
|
+
r.stdout.write(` ${l} ${e.path}${e.isDirectory ? "/" : ""}
|
|
22
|
+
`);
|
|
23
|
+
}
|
|
24
|
+
} catch (t) {
|
|
25
|
+
if (t instanceof d)
|
|
26
|
+
return r.stderr.write(`zip: ${t.message}
|
|
27
|
+
`), 1;
|
|
28
|
+
throw t;
|
|
29
|
+
}
|
|
30
|
+
return 0;
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
m as default
|
|
34
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lifo-sh/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "vite build",
|
|
19
|
+
"typecheck": "tsc --noEmit",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@xterm/xterm": "^5.5.0",
|
|
25
|
+
"@xterm/addon-fit": "^0.10.0",
|
|
26
|
+
"@xterm/addon-webgl": "^0.18.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^5.7.0",
|
|
30
|
+
"vite": "^6.0.0",
|
|
31
|
+
"vite-plugin-dts": "^4.5.0",
|
|
32
|
+
"vitest": "^3.0.0"
|
|
33
|
+
}
|
|
34
|
+
}
|