@ecmaos/kernel 0.6.5 → 0.6.6
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/.vite/manifest.json +12 -12
- package/dist/{install-CNseKaMB.js → install-vHqmAl7t.js} +2 -2
- package/dist/{install-CNseKaMB.js.map → install-vHqmAl7t.js.map} +1 -1
- package/dist/{kernel-C_Xvcpox.js → kernel-DZB_DlxI.js} +668 -140
- package/dist/kernel-DZB_DlxI.js.map +1 -0
- package/dist/kernel.js +1 -1
- package/dist/{topbar.min-D7kPyIYf.js → topbar.min-BAV19NIs.js} +2 -2
- package/dist/{topbar.min-D7kPyIYf.js.map → topbar.min-BAV19NIs.js.map} +1 -1
- package/dist/ui.js +4 -2
- package/dist/ui.js.map +1 -1
- package/dist/{uninstall-CamF7_kP.js → uninstall-Ds11Scu8.js} +2 -2
- package/dist/{uninstall-CamF7_kP.js.map → uninstall-Ds11Scu8.js.map} +1 -1
- package/package.json +5 -5
- package/dist/kernel-C_Xvcpox.js.map +0 -1
|
@@ -28621,7 +28621,7 @@ const _Dom = class _Dom {
|
|
|
28621
28621
|
}
|
|
28622
28622
|
async topbar(show) {
|
|
28623
28623
|
if (!this._topbar) return;
|
|
28624
|
-
const { default: topbar } = await import("./topbar.min-
|
|
28624
|
+
const { default: topbar } = await import("./topbar.min-BAV19NIs.js").then((n) => n.t);
|
|
28625
28625
|
this._topbarShow = show ?? !this._topbarShow;
|
|
28626
28626
|
if (this._topbarShow) topbar.show();
|
|
28627
28627
|
else topbar.hide();
|
|
@@ -59691,7 +59691,7 @@ const _TerminalCommand = class _TerminalCommand {
|
|
|
59691
59691
|
};
|
|
59692
59692
|
__name(_TerminalCommand, "TerminalCommand");
|
|
59693
59693
|
let TerminalCommand = _TerminalCommand;
|
|
59694
|
-
function createCommand$
|
|
59694
|
+
function createCommand$l(kernel, shell, terminal) {
|
|
59695
59695
|
return new TerminalCommand({
|
|
59696
59696
|
command: "cat",
|
|
59697
59697
|
description: "Concatenate files and print on the standard output",
|
|
@@ -59706,6 +59706,8 @@ function createCommand$i(kernel, shell, terminal) {
|
|
|
59706
59706
|
run: /* @__PURE__ */ __name(async (argv, process2) => {
|
|
59707
59707
|
if (!process2) return 1;
|
|
59708
59708
|
const writer = process2.stdout.getWriter();
|
|
59709
|
+
const isTTY = process2.stdoutIsTTY ?? false;
|
|
59710
|
+
let lastByte;
|
|
59709
59711
|
try {
|
|
59710
59712
|
if (!argv.path || !argv.path[0]) {
|
|
59711
59713
|
const reader = process2.stdin.getReader();
|
|
@@ -59713,11 +59715,17 @@ function createCommand$i(kernel, shell, terminal) {
|
|
|
59713
59715
|
while (true) {
|
|
59714
59716
|
const { done, value } = await reader.read();
|
|
59715
59717
|
if (done) break;
|
|
59718
|
+
if (value.length > 0) {
|
|
59719
|
+
lastByte = value[value.length - 1];
|
|
59720
|
+
}
|
|
59716
59721
|
await writer.write(value);
|
|
59717
59722
|
}
|
|
59718
59723
|
} finally {
|
|
59719
59724
|
reader.releaseLock();
|
|
59720
59725
|
}
|
|
59726
|
+
if (isTTY && lastByte !== void 0 && lastByte !== 10) {
|
|
59727
|
+
await writer.write(new Uint8Array([10]));
|
|
59728
|
+
}
|
|
59721
59729
|
return 0;
|
|
59722
59730
|
}
|
|
59723
59731
|
const files = argv.path || [];
|
|
@@ -59740,7 +59748,11 @@ function createCommand$i(kernel, shell, terminal) {
|
|
|
59740
59748
|
const data = new Uint8Array(chunkSize);
|
|
59741
59749
|
const readSize = Math.min(chunkSize, stat2.size - bytesRead);
|
|
59742
59750
|
await handle.read(data, 0, readSize, bytesRead);
|
|
59743
|
-
|
|
59751
|
+
const chunk = data.subarray(0, readSize);
|
|
59752
|
+
if (chunk.length > 0) {
|
|
59753
|
+
lastByte = chunk[chunk.length - 1];
|
|
59754
|
+
}
|
|
59755
|
+
await writer.write(chunk);
|
|
59744
59756
|
bytesRead += readSize;
|
|
59745
59757
|
}
|
|
59746
59758
|
} else {
|
|
@@ -59757,7 +59769,11 @@ function createCommand$i(kernel, shell, terminal) {
|
|
|
59757
59769
|
if (bytesRead > 0) {
|
|
59758
59770
|
const bytesToWrite = maxBytes ? Math.min(bytesRead, maxBytes - totalBytesRead) : bytesRead;
|
|
59759
59771
|
if (bytesToWrite > 0) {
|
|
59760
|
-
|
|
59772
|
+
const chunk = data.subarray(0, bytesToWrite);
|
|
59773
|
+
if (chunk.length > 0) {
|
|
59774
|
+
lastByte = chunk[chunk.length - 1];
|
|
59775
|
+
}
|
|
59776
|
+
await writer.write(chunk);
|
|
59761
59777
|
totalBytesRead += bytesToWrite;
|
|
59762
59778
|
}
|
|
59763
59779
|
}
|
|
@@ -59767,16 +59783,18 @@ function createCommand$i(kernel, shell, terminal) {
|
|
|
59767
59783
|
kernel.terminal.events.off(TerminalEvents.INTERRUPT, interruptHandler);
|
|
59768
59784
|
}
|
|
59769
59785
|
}
|
|
59786
|
+
if (isTTY && lastByte !== void 0 && lastByte !== 10) {
|
|
59787
|
+
await writer.write(new Uint8Array([10]));
|
|
59788
|
+
}
|
|
59770
59789
|
return 0;
|
|
59771
59790
|
} finally {
|
|
59772
59791
|
writer.releaseLock();
|
|
59773
|
-
await writeStdout(process2, terminal, "\n");
|
|
59774
59792
|
}
|
|
59775
59793
|
}, "run")
|
|
59776
59794
|
});
|
|
59777
59795
|
}
|
|
59778
|
-
__name(createCommand$
|
|
59779
|
-
function createCommand$
|
|
59796
|
+
__name(createCommand$l, "createCommand$l");
|
|
59797
|
+
function createCommand$k(kernel, shell, terminal) {
|
|
59780
59798
|
return new TerminalCommand({
|
|
59781
59799
|
command: "cd",
|
|
59782
59800
|
description: "Change the shell working directory",
|
|
@@ -59797,8 +59815,8 @@ function createCommand$h(kernel, shell, terminal) {
|
|
|
59797
59815
|
}, "run")
|
|
59798
59816
|
});
|
|
59799
59817
|
}
|
|
59800
|
-
__name(createCommand$
|
|
59801
|
-
function createCommand$
|
|
59818
|
+
__name(createCommand$k, "createCommand$k");
|
|
59819
|
+
function createCommand$j(kernel, shell, terminal) {
|
|
59802
59820
|
return new TerminalCommand({
|
|
59803
59821
|
command: "chmod",
|
|
59804
59822
|
description: "Change file mode bits",
|
|
@@ -59824,8 +59842,8 @@ function createCommand$g(kernel, shell, terminal) {
|
|
|
59824
59842
|
}, "run")
|
|
59825
59843
|
});
|
|
59826
59844
|
}
|
|
59827
|
-
__name(createCommand$
|
|
59828
|
-
function createCommand$
|
|
59845
|
+
__name(createCommand$j, "createCommand$j");
|
|
59846
|
+
function createCommand$i(kernel, shell, terminal) {
|
|
59829
59847
|
return new TerminalCommand({
|
|
59830
59848
|
command: "cp",
|
|
59831
59849
|
description: "Copy files",
|
|
@@ -59847,8 +59865,8 @@ function createCommand$f(kernel, shell, terminal) {
|
|
|
59847
59865
|
}, "run")
|
|
59848
59866
|
});
|
|
59849
59867
|
}
|
|
59850
|
-
__name(createCommand$
|
|
59851
|
-
function createCommand$
|
|
59868
|
+
__name(createCommand$i, "createCommand$i");
|
|
59869
|
+
function createCommand$h(kernel, shell, terminal) {
|
|
59852
59870
|
return new TerminalCommand({
|
|
59853
59871
|
command: "echo",
|
|
59854
59872
|
description: "Print arguments to the standard output",
|
|
@@ -59857,11 +59875,14 @@ function createCommand$e(kernel, shell, terminal) {
|
|
|
59857
59875
|
terminal,
|
|
59858
59876
|
options: [
|
|
59859
59877
|
{ name: "help", type: Boolean, description: kernel.i18n.t("Display help") },
|
|
59878
|
+
{ name: "n", type: Boolean, alias: "n", description: "Do not output the trailing newline" },
|
|
59860
59879
|
{ name: "text", type: String, typeLabel: "{underline text}", defaultOption: true, multiple: true, description: "The text to print" }
|
|
59861
59880
|
],
|
|
59862
59881
|
run: /* @__PURE__ */ __name(async (argv, process2) => {
|
|
59882
|
+
const noNewline = argv.n || false;
|
|
59863
59883
|
const text = (argv.text || []).join(" ");
|
|
59864
|
-
const
|
|
59884
|
+
const output2 = noNewline ? text : text + "\n";
|
|
59885
|
+
const data = new TextEncoder().encode(output2);
|
|
59865
59886
|
if (process2) {
|
|
59866
59887
|
const writer = process2.stdout.getWriter();
|
|
59867
59888
|
try {
|
|
@@ -59870,14 +59891,298 @@ function createCommand$e(kernel, shell, terminal) {
|
|
|
59870
59891
|
writer.releaseLock();
|
|
59871
59892
|
}
|
|
59872
59893
|
} else {
|
|
59873
|
-
terminal.write(
|
|
59894
|
+
terminal.write(output2);
|
|
59874
59895
|
}
|
|
59875
59896
|
return 0;
|
|
59876
59897
|
}, "run")
|
|
59877
59898
|
});
|
|
59878
59899
|
}
|
|
59879
|
-
__name(createCommand$
|
|
59880
|
-
function createCommand$
|
|
59900
|
+
__name(createCommand$h, "createCommand$h");
|
|
59901
|
+
function createCommand$g(kernel, shell, terminal) {
|
|
59902
|
+
return new TerminalCommand({
|
|
59903
|
+
command: "grep",
|
|
59904
|
+
description: "Search for patterns in files or standard input",
|
|
59905
|
+
kernel,
|
|
59906
|
+
shell,
|
|
59907
|
+
terminal,
|
|
59908
|
+
options: [
|
|
59909
|
+
{ name: "help", type: Boolean, description: kernel.i18n.t("Display help") },
|
|
59910
|
+
{ name: "ignore-case", type: Boolean, alias: "i", description: "Ignore case distinctions" },
|
|
59911
|
+
{ name: "line-number", type: Boolean, alias: "n", description: "Print line number with output lines" },
|
|
59912
|
+
{ name: "args", type: String, defaultOption: true, multiple: true, description: "Pattern and file(s) to search" }
|
|
59913
|
+
],
|
|
59914
|
+
run: /* @__PURE__ */ __name(async (argv, process2) => {
|
|
59915
|
+
if (!process2) return 1;
|
|
59916
|
+
const args = argv.args || [];
|
|
59917
|
+
if (args.length === 0 || !args[0]) {
|
|
59918
|
+
await writelnStderr(process2, terminal, "grep: pattern is required");
|
|
59919
|
+
return 1;
|
|
59920
|
+
}
|
|
59921
|
+
const pattern2 = args[0];
|
|
59922
|
+
const files = args.slice(1);
|
|
59923
|
+
const ignoreCase = argv["ignore-case"] || false;
|
|
59924
|
+
const showLineNumbers = argv["line-number"] || false;
|
|
59925
|
+
const flags = ignoreCase ? "i" : "";
|
|
59926
|
+
let regex;
|
|
59927
|
+
try {
|
|
59928
|
+
regex = new RegExp(pattern2, flags);
|
|
59929
|
+
} catch (error) {
|
|
59930
|
+
await writelnStderr(process2, terminal, `grep: invalid pattern: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
59931
|
+
return 1;
|
|
59932
|
+
}
|
|
59933
|
+
const writer = process2.stdout.getWriter();
|
|
59934
|
+
let exitCode = 0;
|
|
59935
|
+
try {
|
|
59936
|
+
if (files.length === 0) {
|
|
59937
|
+
if (!process2.stdin) {
|
|
59938
|
+
await writelnStderr(process2, terminal, "grep: No input provided");
|
|
59939
|
+
return 1;
|
|
59940
|
+
}
|
|
59941
|
+
const reader = process2.stdin.getReader();
|
|
59942
|
+
let currentLineNumber = 1;
|
|
59943
|
+
let buffer2 = "";
|
|
59944
|
+
try {
|
|
59945
|
+
while (true) {
|
|
59946
|
+
const { done, value } = await reader.read();
|
|
59947
|
+
if (done) break;
|
|
59948
|
+
const chunk = new TextDecoder().decode(value, { stream: true });
|
|
59949
|
+
buffer2 += chunk;
|
|
59950
|
+
const lines = buffer2.split("\n");
|
|
59951
|
+
buffer2 = lines.pop() || "";
|
|
59952
|
+
for (const line3 of lines) {
|
|
59953
|
+
if (regex.test(line3)) {
|
|
59954
|
+
const output2 = showLineNumbers ? `${currentLineNumber}:${line3}
|
|
59955
|
+
` : `${line3}
|
|
59956
|
+
`;
|
|
59957
|
+
await writer.write(new TextEncoder().encode(output2));
|
|
59958
|
+
}
|
|
59959
|
+
currentLineNumber++;
|
|
59960
|
+
}
|
|
59961
|
+
}
|
|
59962
|
+
if (buffer2 && regex.test(buffer2)) {
|
|
59963
|
+
const output2 = showLineNumbers ? `${currentLineNumber}:${buffer2}
|
|
59964
|
+
` : `${buffer2}
|
|
59965
|
+
`;
|
|
59966
|
+
await writer.write(new TextEncoder().encode(output2));
|
|
59967
|
+
}
|
|
59968
|
+
} finally {
|
|
59969
|
+
reader.releaseLock();
|
|
59970
|
+
}
|
|
59971
|
+
} else {
|
|
59972
|
+
for (const file of files) {
|
|
59973
|
+
const fullPath = path$1.resolve(shell.cwd, file);
|
|
59974
|
+
let interrupted = false;
|
|
59975
|
+
const interruptHandler = /* @__PURE__ */ __name(() => {
|
|
59976
|
+
interrupted = true;
|
|
59977
|
+
}, "interruptHandler");
|
|
59978
|
+
kernel.terminal.events.on(TerminalEvents.INTERRUPT, interruptHandler);
|
|
59979
|
+
try {
|
|
59980
|
+
if (fullPath.startsWith("/dev")) {
|
|
59981
|
+
await writelnStderr(process2, terminal, `grep: ${file}: cannot search device files`);
|
|
59982
|
+
exitCode = 1;
|
|
59983
|
+
continue;
|
|
59984
|
+
}
|
|
59985
|
+
const handle = await shell.context.fs.promises.open(fullPath, "r");
|
|
59986
|
+
const stat2 = await shell.context.fs.promises.stat(fullPath);
|
|
59987
|
+
let bytesRead = 0;
|
|
59988
|
+
const chunkSize = 1024;
|
|
59989
|
+
let buffer2 = "";
|
|
59990
|
+
let currentLineNumber = 1;
|
|
59991
|
+
while (bytesRead < stat2.size) {
|
|
59992
|
+
if (interrupted) break;
|
|
59993
|
+
const data = new Uint8Array(chunkSize);
|
|
59994
|
+
const readSize = Math.min(chunkSize, stat2.size - bytesRead);
|
|
59995
|
+
await handle.read(data, 0, readSize, bytesRead);
|
|
59996
|
+
const chunk = data.subarray(0, readSize);
|
|
59997
|
+
const text = new TextDecoder().decode(chunk, { stream: true });
|
|
59998
|
+
buffer2 += text;
|
|
59999
|
+
const lines = buffer2.split("\n");
|
|
60000
|
+
buffer2 = lines.pop() || "";
|
|
60001
|
+
for (const line3 of lines) {
|
|
60002
|
+
if (regex.test(line3)) {
|
|
60003
|
+
const prefix = files.length > 1 ? `${file}:` : "";
|
|
60004
|
+
const lineNumPrefix = showLineNumbers ? `${currentLineNumber}:` : "";
|
|
60005
|
+
const output2 = `${prefix}${lineNumPrefix}${line3}
|
|
60006
|
+
`;
|
|
60007
|
+
await writer.write(new TextEncoder().encode(output2));
|
|
60008
|
+
}
|
|
60009
|
+
currentLineNumber++;
|
|
60010
|
+
}
|
|
60011
|
+
bytesRead += readSize;
|
|
60012
|
+
}
|
|
60013
|
+
if (buffer2 && regex.test(buffer2)) {
|
|
60014
|
+
const prefix = files.length > 1 ? `${file}:` : "";
|
|
60015
|
+
const lineNumPrefix = showLineNumbers ? `${currentLineNumber}:` : "";
|
|
60016
|
+
const output2 = `${prefix}${lineNumPrefix}${buffer2}
|
|
60017
|
+
`;
|
|
60018
|
+
await writer.write(new TextEncoder().encode(output2));
|
|
60019
|
+
}
|
|
60020
|
+
} catch (error) {
|
|
60021
|
+
await writelnStderr(process2, terminal, `grep: ${file}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
60022
|
+
exitCode = 1;
|
|
60023
|
+
} finally {
|
|
60024
|
+
kernel.terminal.events.off(TerminalEvents.INTERRUPT, interruptHandler);
|
|
60025
|
+
}
|
|
60026
|
+
}
|
|
60027
|
+
}
|
|
60028
|
+
return exitCode;
|
|
60029
|
+
} finally {
|
|
60030
|
+
writer.releaseLock();
|
|
60031
|
+
}
|
|
60032
|
+
}, "run")
|
|
60033
|
+
});
|
|
60034
|
+
}
|
|
60035
|
+
__name(createCommand$g, "createCommand$g");
|
|
60036
|
+
function createCommand$f(kernel, shell, terminal) {
|
|
60037
|
+
return new TerminalCommand({
|
|
60038
|
+
command: "head",
|
|
60039
|
+
description: "Print the first lines of files",
|
|
60040
|
+
kernel,
|
|
60041
|
+
shell,
|
|
60042
|
+
terminal,
|
|
60043
|
+
options: [
|
|
60044
|
+
{ name: "help", type: Boolean, description: kernel.i18n.t("Display help") },
|
|
60045
|
+
{ name: "lines", type: Number, alias: "n", description: "Print the first NUM lines instead of the first 10" },
|
|
60046
|
+
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, multiple: true, description: "The path(s) to the file(s) to read" }
|
|
60047
|
+
],
|
|
60048
|
+
run: /* @__PURE__ */ __name(async (argv, process2) => {
|
|
60049
|
+
if (!process2) return 1;
|
|
60050
|
+
const writer = process2.stdout.getWriter();
|
|
60051
|
+
const numLines = argv.lines ?? 10;
|
|
60052
|
+
try {
|
|
60053
|
+
if (!argv.path || !argv.path[0]) {
|
|
60054
|
+
if (!process2.stdin) {
|
|
60055
|
+
return 0;
|
|
60056
|
+
}
|
|
60057
|
+
const reader = process2.stdin.getReader();
|
|
60058
|
+
const decoder2 = new TextDecoder();
|
|
60059
|
+
const lines = [];
|
|
60060
|
+
let buffer2 = "";
|
|
60061
|
+
try {
|
|
60062
|
+
while (true) {
|
|
60063
|
+
let readResult;
|
|
60064
|
+
try {
|
|
60065
|
+
readResult = await reader.read();
|
|
60066
|
+
} catch (error) {
|
|
60067
|
+
if (error instanceof Error) {
|
|
60068
|
+
throw error;
|
|
60069
|
+
}
|
|
60070
|
+
break;
|
|
60071
|
+
}
|
|
60072
|
+
const { done, value } = readResult;
|
|
60073
|
+
if (done) {
|
|
60074
|
+
buffer2 += decoder2.decode();
|
|
60075
|
+
break;
|
|
60076
|
+
}
|
|
60077
|
+
if (value) {
|
|
60078
|
+
buffer2 += decoder2.decode(value, { stream: true });
|
|
60079
|
+
const newLines = buffer2.split("\n");
|
|
60080
|
+
buffer2 = newLines.pop() || "";
|
|
60081
|
+
lines.push(...newLines);
|
|
60082
|
+
if (lines.length >= numLines) break;
|
|
60083
|
+
}
|
|
60084
|
+
}
|
|
60085
|
+
if (buffer2 && lines.length < numLines) {
|
|
60086
|
+
lines.push(buffer2);
|
|
60087
|
+
}
|
|
60088
|
+
} finally {
|
|
60089
|
+
try {
|
|
60090
|
+
reader.releaseLock();
|
|
60091
|
+
} catch {
|
|
60092
|
+
}
|
|
60093
|
+
}
|
|
60094
|
+
const output2 = lines.slice(0, numLines).join("\n");
|
|
60095
|
+
if (output2) {
|
|
60096
|
+
await writer.write(new TextEncoder().encode(output2 + "\n"));
|
|
60097
|
+
}
|
|
60098
|
+
return 0;
|
|
60099
|
+
}
|
|
60100
|
+
const files = argv.path || [];
|
|
60101
|
+
const isMultipleFiles = files.length > 1;
|
|
60102
|
+
for (let i = 0; i < files.length; i++) {
|
|
60103
|
+
const file = files[i];
|
|
60104
|
+
if (!file) continue;
|
|
60105
|
+
const fullPath = path$1.resolve(shell.cwd, file);
|
|
60106
|
+
if (isMultipleFiles) {
|
|
60107
|
+
const header = i > 0 ? "\n" : "";
|
|
60108
|
+
await writer.write(new TextEncoder().encode(`${header}==> ${file} <==
|
|
60109
|
+
`));
|
|
60110
|
+
}
|
|
60111
|
+
let interrupted = false;
|
|
60112
|
+
const interruptHandler = /* @__PURE__ */ __name(() => {
|
|
60113
|
+
interrupted = true;
|
|
60114
|
+
}, "interruptHandler");
|
|
60115
|
+
kernel.terminal.events.on(TerminalEvents.INTERRUPT, interruptHandler);
|
|
60116
|
+
try {
|
|
60117
|
+
if (!fullPath.startsWith("/dev")) {
|
|
60118
|
+
const handle = await shell.context.fs.promises.open(fullPath, "r");
|
|
60119
|
+
const stat2 = await shell.context.fs.promises.stat(fullPath);
|
|
60120
|
+
const decoder2 = new TextDecoder();
|
|
60121
|
+
const lines = [];
|
|
60122
|
+
let buffer2 = "";
|
|
60123
|
+
let bytesRead = 0;
|
|
60124
|
+
const chunkSize = 1024;
|
|
60125
|
+
while (bytesRead < stat2.size && lines.length < numLines) {
|
|
60126
|
+
if (interrupted) break;
|
|
60127
|
+
const data = new Uint8Array(chunkSize);
|
|
60128
|
+
const readSize = Math.min(chunkSize, stat2.size - bytesRead);
|
|
60129
|
+
await handle.read(data, 0, readSize, bytesRead);
|
|
60130
|
+
const chunk = data.subarray(0, readSize);
|
|
60131
|
+
buffer2 += decoder2.decode(chunk, { stream: true });
|
|
60132
|
+
const newLines = buffer2.split("\n");
|
|
60133
|
+
buffer2 = newLines.pop() || "";
|
|
60134
|
+
lines.push(...newLines);
|
|
60135
|
+
bytesRead += readSize;
|
|
60136
|
+
if (lines.length >= numLines) break;
|
|
60137
|
+
}
|
|
60138
|
+
if (buffer2 && lines.length < numLines) {
|
|
60139
|
+
lines.push(buffer2);
|
|
60140
|
+
}
|
|
60141
|
+
const output2 = lines.slice(0, numLines).join("\n");
|
|
60142
|
+
if (output2) {
|
|
60143
|
+
await writer.write(new TextEncoder().encode(output2 + "\n"));
|
|
60144
|
+
}
|
|
60145
|
+
} else {
|
|
60146
|
+
const device = await shell.context.fs.promises.open(fullPath);
|
|
60147
|
+
const decoder2 = new TextDecoder();
|
|
60148
|
+
const lines = [];
|
|
60149
|
+
let buffer2 = "";
|
|
60150
|
+
const chunkSize = 1024;
|
|
60151
|
+
const data = new Uint8Array(chunkSize);
|
|
60152
|
+
let bytesRead = 0;
|
|
60153
|
+
do {
|
|
60154
|
+
if (interrupted) break;
|
|
60155
|
+
const result = await device.read(data);
|
|
60156
|
+
bytesRead = result.bytesRead;
|
|
60157
|
+
if (bytesRead > 0) {
|
|
60158
|
+
buffer2 += decoder2.decode(data.subarray(0, bytesRead), { stream: true });
|
|
60159
|
+
const newLines = buffer2.split("\n");
|
|
60160
|
+
buffer2 = newLines.pop() || "";
|
|
60161
|
+
lines.push(...newLines);
|
|
60162
|
+
if (lines.length >= numLines) break;
|
|
60163
|
+
}
|
|
60164
|
+
} while (bytesRead > 0 && lines.length < numLines);
|
|
60165
|
+
if (buffer2 && lines.length < numLines) {
|
|
60166
|
+
lines.push(buffer2);
|
|
60167
|
+
}
|
|
60168
|
+
const output2 = lines.slice(0, numLines).join("\n");
|
|
60169
|
+
if (output2) {
|
|
60170
|
+
await writer.write(new TextEncoder().encode(output2 + "\n"));
|
|
60171
|
+
}
|
|
60172
|
+
}
|
|
60173
|
+
} finally {
|
|
60174
|
+
kernel.terminal.events.off(TerminalEvents.INTERRUPT, interruptHandler);
|
|
60175
|
+
}
|
|
60176
|
+
}
|
|
60177
|
+
return 0;
|
|
60178
|
+
} finally {
|
|
60179
|
+
writer.releaseLock();
|
|
60180
|
+
}
|
|
60181
|
+
}, "run")
|
|
60182
|
+
});
|
|
60183
|
+
}
|
|
60184
|
+
__name(createCommand$f, "createCommand$f");
|
|
60185
|
+
function createCommand$e(kernel, shell, terminal) {
|
|
59881
60186
|
return new TerminalCommand({
|
|
59882
60187
|
command: "ln",
|
|
59883
60188
|
description: "Create links between files",
|
|
@@ -59969,7 +60274,7 @@ function createCommand$d(kernel, shell, terminal) {
|
|
|
59969
60274
|
}, "run")
|
|
59970
60275
|
});
|
|
59971
60276
|
}
|
|
59972
|
-
__name(createCommand$
|
|
60277
|
+
__name(createCommand$e, "createCommand$e");
|
|
59973
60278
|
var humanFormat$2 = { exports: {} };
|
|
59974
60279
|
var humanFormat$1 = humanFormat$2.exports;
|
|
59975
60280
|
var hasRequiredHumanFormat;
|
|
@@ -60250,7 +60555,7 @@ function requireHumanFormat() {
|
|
|
60250
60555
|
__name(requireHumanFormat, "requireHumanFormat");
|
|
60251
60556
|
var humanFormatExports = requireHumanFormat();
|
|
60252
60557
|
const humanFormat = /* @__PURE__ */ getDefaultExportFromCjs(humanFormatExports);
|
|
60253
|
-
function createCommand$
|
|
60558
|
+
function createCommand$d(kernel, shell, terminal) {
|
|
60254
60559
|
return new TerminalCommand({
|
|
60255
60560
|
command: "ls",
|
|
60256
60561
|
description: "List directory contents",
|
|
@@ -60386,8 +60691,10 @@ function createCommand$c(kernel, shell, terminal) {
|
|
|
60386
60691
|
const linkInfo = getLinkInfo(file.linkTarget, file.linkStats, file.stats);
|
|
60387
60692
|
if (linkInfo) return linkInfo;
|
|
60388
60693
|
if (descriptions.has(path$1.resolve(fullPath, file.name))) return descriptions.get(path$1.resolve(fullPath, file.name));
|
|
60389
|
-
|
|
60390
|
-
|
|
60694
|
+
if (file.name.includes(".")) {
|
|
60695
|
+
const ext = file.name.split(".").pop();
|
|
60696
|
+
if (ext && descriptions.has("." + ext)) return descriptions.get("." + ext);
|
|
60697
|
+
}
|
|
60391
60698
|
if (!file.stats) return "";
|
|
60392
60699
|
if (file.stats.isBlockDevice() || file.stats.isCharacterDevice()) ;
|
|
60393
60700
|
return "";
|
|
@@ -60415,8 +60722,8 @@ function createCommand$c(kernel, shell, terminal) {
|
|
|
60415
60722
|
}, "run")
|
|
60416
60723
|
});
|
|
60417
60724
|
}
|
|
60418
|
-
__name(createCommand$
|
|
60419
|
-
function createCommand$
|
|
60725
|
+
__name(createCommand$d, "createCommand$d");
|
|
60726
|
+
function createCommand$c(kernel, shell, terminal) {
|
|
60420
60727
|
return new TerminalCommand({
|
|
60421
60728
|
command: "mkdir",
|
|
60422
60729
|
description: "Create a directory",
|
|
@@ -60435,8 +60742,8 @@ function createCommand$b(kernel, shell, terminal) {
|
|
|
60435
60742
|
}, "run")
|
|
60436
60743
|
});
|
|
60437
60744
|
}
|
|
60438
|
-
__name(createCommand$
|
|
60439
|
-
function createCommand$
|
|
60745
|
+
__name(createCommand$c, "createCommand$c");
|
|
60746
|
+
function createCommand$b(kernel, shell, terminal) {
|
|
60440
60747
|
return new TerminalCommand({
|
|
60441
60748
|
command: "mv",
|
|
60442
60749
|
description: "Move or rename files",
|
|
@@ -60475,8 +60782,8 @@ function createCommand$a(kernel, shell, terminal) {
|
|
|
60475
60782
|
}, "run")
|
|
60476
60783
|
});
|
|
60477
60784
|
}
|
|
60478
|
-
__name(createCommand$
|
|
60479
|
-
function createCommand$
|
|
60785
|
+
__name(createCommand$b, "createCommand$b");
|
|
60786
|
+
function createCommand$a(kernel, shell, terminal) {
|
|
60480
60787
|
return new TerminalCommand({
|
|
60481
60788
|
command: "pwd",
|
|
60482
60789
|
description: "Print the shell working directory",
|
|
@@ -60492,8 +60799,8 @@ function createCommand$9(kernel, shell, terminal) {
|
|
|
60492
60799
|
}, "run")
|
|
60493
60800
|
});
|
|
60494
60801
|
}
|
|
60495
|
-
__name(createCommand$
|
|
60496
|
-
function createCommand$
|
|
60802
|
+
__name(createCommand$a, "createCommand$a");
|
|
60803
|
+
function createCommand$9(kernel, shell, terminal) {
|
|
60497
60804
|
return new TerminalCommand({
|
|
60498
60805
|
command: "rm",
|
|
60499
60806
|
description: "Remove files or directories",
|
|
@@ -60513,8 +60820,8 @@ function createCommand$8(kernel, shell, terminal) {
|
|
|
60513
60820
|
}, "run")
|
|
60514
60821
|
});
|
|
60515
60822
|
}
|
|
60516
|
-
__name(createCommand$
|
|
60517
|
-
function createCommand$
|
|
60823
|
+
__name(createCommand$9, "createCommand$9");
|
|
60824
|
+
function createCommand$8(kernel, shell, terminal) {
|
|
60518
60825
|
return new TerminalCommand({
|
|
60519
60826
|
command: "rmdir",
|
|
60520
60827
|
description: "Remove a directory",
|
|
@@ -60533,7 +60840,7 @@ function createCommand$7(kernel, shell, terminal) {
|
|
|
60533
60840
|
}, "run")
|
|
60534
60841
|
});
|
|
60535
60842
|
}
|
|
60536
|
-
__name(createCommand$
|
|
60843
|
+
__name(createCommand$8, "createCommand$8");
|
|
60537
60844
|
const MAX_32_BITS = 4294967295;
|
|
60538
60845
|
const MAX_16_BITS = 65535;
|
|
60539
60846
|
const MAX_8_BITS = 255;
|
|
@@ -65328,7 +65635,7 @@ const table = {
|
|
|
65328
65635
|
return mimeTypes;
|
|
65329
65636
|
})();
|
|
65330
65637
|
t(configure);
|
|
65331
|
-
function createCommand$
|
|
65638
|
+
function createCommand$7(kernel, shell, terminal) {
|
|
65332
65639
|
return new TerminalCommand({
|
|
65333
65640
|
command: "stat",
|
|
65334
65641
|
description: "Display information about a file or directory",
|
|
@@ -65358,8 +65665,8 @@ function createCommand$6(kernel, shell, terminal) {
|
|
|
65358
65665
|
}, "run")
|
|
65359
65666
|
});
|
|
65360
65667
|
}
|
|
65361
|
-
__name(createCommand$
|
|
65362
|
-
function createCommand$
|
|
65668
|
+
__name(createCommand$7, "createCommand$7");
|
|
65669
|
+
function createCommand$6(kernel, shell, terminal) {
|
|
65363
65670
|
return new TerminalCommand({
|
|
65364
65671
|
command: "touch",
|
|
65365
65672
|
description: "Create an empty file",
|
|
@@ -65378,37 +65685,84 @@ function createCommand$5(kernel, shell, terminal) {
|
|
|
65378
65685
|
}, "run")
|
|
65379
65686
|
});
|
|
65380
65687
|
}
|
|
65381
|
-
__name(createCommand$
|
|
65382
|
-
function createCommand$
|
|
65688
|
+
__name(createCommand$6, "createCommand$6");
|
|
65689
|
+
function createCommand$5(kernel, shell, terminal) {
|
|
65383
65690
|
return new TerminalCommand({
|
|
65384
65691
|
command: "hex",
|
|
65385
|
-
description: "Display file contents in hexadecimal format",
|
|
65692
|
+
description: "Display file contents or stdin in hexadecimal format",
|
|
65386
65693
|
kernel,
|
|
65387
65694
|
shell,
|
|
65388
65695
|
terminal,
|
|
65389
65696
|
options: [
|
|
65390
65697
|
{ name: "help", type: Boolean, description: kernel.i18n.t("Display help") },
|
|
65391
|
-
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the file to display" }
|
|
65698
|
+
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, description: "The path to the file to display (if omitted, reads from stdin)" }
|
|
65392
65699
|
],
|
|
65393
65700
|
run: /* @__PURE__ */ __name(async (argv, process2) => {
|
|
65701
|
+
if (!process2) return 1;
|
|
65394
65702
|
const filePath = argv.path;
|
|
65395
|
-
|
|
65396
|
-
await writelnStderr(process2, terminal, "Usage: hex <file>");
|
|
65397
|
-
return 1;
|
|
65398
|
-
}
|
|
65399
|
-
const fullPath = path$1.resolve(shell.cwd, filePath);
|
|
65703
|
+
let data;
|
|
65400
65704
|
try {
|
|
65401
|
-
|
|
65402
|
-
|
|
65403
|
-
|
|
65404
|
-
|
|
65405
|
-
|
|
65406
|
-
|
|
65407
|
-
|
|
65408
|
-
|
|
65409
|
-
|
|
65705
|
+
if (!filePath) {
|
|
65706
|
+
if (!process2.stdin) {
|
|
65707
|
+
await writelnStderr(process2, terminal, "Usage: hex <file>");
|
|
65708
|
+
await writelnStderr(process2, terminal, " or: <command> | hex");
|
|
65709
|
+
return 1;
|
|
65710
|
+
}
|
|
65711
|
+
if (process2.stdinIsTTY) {
|
|
65712
|
+
await writelnStderr(process2, terminal, "Usage: hex <file>");
|
|
65713
|
+
await writelnStderr(process2, terminal, " or: <command> | hex");
|
|
65714
|
+
return 1;
|
|
65715
|
+
}
|
|
65716
|
+
const reader = process2.stdin.getReader();
|
|
65717
|
+
const chunks = [];
|
|
65718
|
+
try {
|
|
65719
|
+
const first = await reader.read();
|
|
65720
|
+
if (first.done && !first.value) {
|
|
65721
|
+
await writelnStderr(process2, terminal, "Usage: hex <file>");
|
|
65722
|
+
await writelnStderr(process2, terminal, " or: <command> | hex");
|
|
65723
|
+
return 1;
|
|
65724
|
+
}
|
|
65725
|
+
if (first.value) {
|
|
65726
|
+
chunks.push(first.value);
|
|
65727
|
+
}
|
|
65728
|
+
if (!first.done) {
|
|
65729
|
+
while (true) {
|
|
65730
|
+
const { done, value } = await reader.read();
|
|
65731
|
+
if (done) break;
|
|
65732
|
+
if (value) {
|
|
65733
|
+
chunks.push(value);
|
|
65734
|
+
}
|
|
65735
|
+
}
|
|
65736
|
+
}
|
|
65737
|
+
} finally {
|
|
65738
|
+
reader.releaseLock();
|
|
65739
|
+
}
|
|
65740
|
+
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
65741
|
+
if (totalLength === 0) {
|
|
65742
|
+
await writelnStderr(process2, terminal, "Usage: hex <file>");
|
|
65743
|
+
await writelnStderr(process2, terminal, " or: <command> | hex");
|
|
65744
|
+
return 1;
|
|
65745
|
+
}
|
|
65746
|
+
data = new Uint8Array(totalLength);
|
|
65747
|
+
let offset = 0;
|
|
65748
|
+
for (const chunk of chunks) {
|
|
65749
|
+
data.set(chunk, offset);
|
|
65750
|
+
offset += chunk.length;
|
|
65751
|
+
}
|
|
65752
|
+
} else {
|
|
65753
|
+
const fullPath = path$1.resolve(shell.cwd, filePath);
|
|
65754
|
+
const exists2 = await shell.context.fs.promises.exists(fullPath);
|
|
65755
|
+
if (!exists2) {
|
|
65756
|
+
await writelnStderr(process2, terminal, `hex: ${filePath}: No such file or directory`);
|
|
65757
|
+
return 1;
|
|
65758
|
+
}
|
|
65759
|
+
const stats = await shell.context.fs.promises.stat(fullPath);
|
|
65760
|
+
if (stats.isDirectory()) {
|
|
65761
|
+
await writelnStderr(process2, terminal, `hex: ${filePath}: Is a directory`);
|
|
65762
|
+
return 1;
|
|
65763
|
+
}
|
|
65764
|
+
data = await shell.context.fs.promises.readFile(fullPath);
|
|
65410
65765
|
}
|
|
65411
|
-
const data = await shell.context.fs.promises.readFile(fullPath);
|
|
65412
65766
|
const bytesPerLine = 16;
|
|
65413
65767
|
for (let offset = 0; offset < data.length; offset += bytesPerLine) {
|
|
65414
65768
|
const lineBytes = data.slice(offset, offset + bytesPerLine);
|
|
@@ -65445,13 +65799,14 @@ function createCommand$4(kernel, shell, terminal) {
|
|
|
65445
65799
|
}
|
|
65446
65800
|
return 0;
|
|
65447
65801
|
} catch (error) {
|
|
65448
|
-
|
|
65802
|
+
const errorPath = filePath || "stdin";
|
|
65803
|
+
await writelnStderr(process2, terminal, `hex: ${errorPath}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
65449
65804
|
return 1;
|
|
65450
65805
|
}
|
|
65451
65806
|
}, "run")
|
|
65452
65807
|
});
|
|
65453
65808
|
}
|
|
65454
|
-
__name(createCommand$
|
|
65809
|
+
__name(createCommand$5, "createCommand$5");
|
|
65455
65810
|
const csi = "\x1B[";
|
|
65456
65811
|
const ansi = {};
|
|
65457
65812
|
ansi.style = {
|
|
@@ -65629,7 +65984,7 @@ ansi.erase = {
|
|
|
65629
65984
|
return csi + (n || 0) + "K";
|
|
65630
65985
|
}, "inLine")
|
|
65631
65986
|
};
|
|
65632
|
-
function createCommand$
|
|
65987
|
+
function createCommand$4(kernel, shell, terminal) {
|
|
65633
65988
|
return new TerminalCommand({
|
|
65634
65989
|
command: "less",
|
|
65635
65990
|
description: "View file contents interactively",
|
|
@@ -65792,8 +66147,8 @@ function createCommand$3(kernel, shell, terminal) {
|
|
|
65792
66147
|
}, "run")
|
|
65793
66148
|
});
|
|
65794
66149
|
}
|
|
65795
|
-
__name(createCommand$
|
|
65796
|
-
function createCommand$
|
|
66150
|
+
__name(createCommand$4, "createCommand$4");
|
|
66151
|
+
function createCommand$3(kernel, shell, terminal) {
|
|
65797
66152
|
return new TerminalCommand({
|
|
65798
66153
|
command: "passkey",
|
|
65799
66154
|
description: "Manage passkey credentials for WebAuthn authentication",
|
|
@@ -65967,7 +66322,7 @@ function createCommand$2(kernel, shell, terminal) {
|
|
|
65967
66322
|
}, "run")
|
|
65968
66323
|
});
|
|
65969
66324
|
}
|
|
65970
|
-
__name(createCommand$
|
|
66325
|
+
__name(createCommand$3, "createCommand$3");
|
|
65971
66326
|
function parseSedExpression(expr) {
|
|
65972
66327
|
expr = expr.trim();
|
|
65973
66328
|
const substituteMatch = expr.match(/^(\d+)?(,(\d+|\$))?s\/(.+?)\/(.*?)\/([gip]*\d*)$/);
|
|
@@ -66130,7 +66485,7 @@ function applySedCommand(line3, lineNum, totalLines, command) {
|
|
|
66130
66485
|
return { result: line3, shouldPrint: false };
|
|
66131
66486
|
}
|
|
66132
66487
|
__name(applySedCommand, "applySedCommand");
|
|
66133
|
-
function createCommand$
|
|
66488
|
+
function createCommand$2(kernel, shell, terminal) {
|
|
66134
66489
|
return new TerminalCommand({
|
|
66135
66490
|
command: "sed",
|
|
66136
66491
|
description: "Stream editor for filtering and transforming text",
|
|
@@ -66325,8 +66680,8 @@ function createCommand$1(kernel, shell, terminal) {
|
|
|
66325
66680
|
}, "run")
|
|
66326
66681
|
});
|
|
66327
66682
|
}
|
|
66328
|
-
__name(createCommand$
|
|
66329
|
-
function createCommand(kernel, shell, terminal) {
|
|
66683
|
+
__name(createCommand$2, "createCommand$2");
|
|
66684
|
+
function createCommand$1(kernel, shell, terminal) {
|
|
66330
66685
|
return new TerminalCommand({
|
|
66331
66686
|
command: "tee",
|
|
66332
66687
|
description: "Read from standard input and write to standard output and files",
|
|
@@ -66402,28 +66757,173 @@ function createCommand(kernel, shell, terminal) {
|
|
|
66402
66757
|
}, "run")
|
|
66403
66758
|
});
|
|
66404
66759
|
}
|
|
66760
|
+
__name(createCommand$1, "createCommand$1");
|
|
66761
|
+
function createCommand(kernel, shell, terminal) {
|
|
66762
|
+
return new TerminalCommand({
|
|
66763
|
+
command: "tail",
|
|
66764
|
+
description: "Print the last lines of files",
|
|
66765
|
+
kernel,
|
|
66766
|
+
shell,
|
|
66767
|
+
terminal,
|
|
66768
|
+
options: [
|
|
66769
|
+
{ name: "help", type: Boolean, description: kernel.i18n.t("Display help") },
|
|
66770
|
+
{ name: "lines", type: Number, alias: "n", description: "Print the last NUM lines instead of the last 10" },
|
|
66771
|
+
{ name: "path", type: String, typeLabel: "{underline path}", defaultOption: true, multiple: true, description: "The path(s) to the file(s) to read" }
|
|
66772
|
+
],
|
|
66773
|
+
run: /* @__PURE__ */ __name(async (argv, process2) => {
|
|
66774
|
+
if (!process2) return 1;
|
|
66775
|
+
const writer = process2.stdout.getWriter();
|
|
66776
|
+
const numLines = argv.lines ?? 10;
|
|
66777
|
+
try {
|
|
66778
|
+
if (!argv.path || !argv.path[0]) {
|
|
66779
|
+
if (!process2.stdin) {
|
|
66780
|
+
return 0;
|
|
66781
|
+
}
|
|
66782
|
+
const reader = process2.stdin.getReader();
|
|
66783
|
+
const decoder2 = new TextDecoder();
|
|
66784
|
+
const lines = [];
|
|
66785
|
+
let buffer2 = "";
|
|
66786
|
+
try {
|
|
66787
|
+
while (true) {
|
|
66788
|
+
let readResult;
|
|
66789
|
+
try {
|
|
66790
|
+
readResult = await reader.read();
|
|
66791
|
+
} catch (error) {
|
|
66792
|
+
if (error instanceof Error) {
|
|
66793
|
+
throw error;
|
|
66794
|
+
}
|
|
66795
|
+
break;
|
|
66796
|
+
}
|
|
66797
|
+
const { done, value } = readResult;
|
|
66798
|
+
if (done) {
|
|
66799
|
+
buffer2 += decoder2.decode();
|
|
66800
|
+
break;
|
|
66801
|
+
}
|
|
66802
|
+
if (value) {
|
|
66803
|
+
buffer2 += decoder2.decode(value, { stream: true });
|
|
66804
|
+
const newLines = buffer2.split("\n");
|
|
66805
|
+
buffer2 = newLines.pop() || "";
|
|
66806
|
+
lines.push(...newLines);
|
|
66807
|
+
}
|
|
66808
|
+
}
|
|
66809
|
+
if (buffer2) {
|
|
66810
|
+
lines.push(buffer2);
|
|
66811
|
+
}
|
|
66812
|
+
} finally {
|
|
66813
|
+
try {
|
|
66814
|
+
reader.releaseLock();
|
|
66815
|
+
} catch {
|
|
66816
|
+
}
|
|
66817
|
+
}
|
|
66818
|
+
const output2 = lines.slice(-numLines).join("\n");
|
|
66819
|
+
if (output2) {
|
|
66820
|
+
await writer.write(new TextEncoder().encode(output2 + "\n"));
|
|
66821
|
+
}
|
|
66822
|
+
return 0;
|
|
66823
|
+
}
|
|
66824
|
+
const files = argv.path || [];
|
|
66825
|
+
const isMultipleFiles = files.length > 1;
|
|
66826
|
+
for (let i = 0; i < files.length; i++) {
|
|
66827
|
+
const file = files[i];
|
|
66828
|
+
if (!file) continue;
|
|
66829
|
+
const fullPath = path$1.resolve(shell.cwd, file);
|
|
66830
|
+
if (isMultipleFiles) {
|
|
66831
|
+
const header = i > 0 ? "\n" : "";
|
|
66832
|
+
await writer.write(new TextEncoder().encode(`${header}==> ${file} <==
|
|
66833
|
+
`));
|
|
66834
|
+
}
|
|
66835
|
+
let interrupted = false;
|
|
66836
|
+
const interruptHandler = /* @__PURE__ */ __name(() => {
|
|
66837
|
+
interrupted = true;
|
|
66838
|
+
}, "interruptHandler");
|
|
66839
|
+
kernel.terminal.events.on(TerminalEvents.INTERRUPT, interruptHandler);
|
|
66840
|
+
try {
|
|
66841
|
+
if (!fullPath.startsWith("/dev")) {
|
|
66842
|
+
const handle = await shell.context.fs.promises.open(fullPath, "r");
|
|
66843
|
+
const stat2 = await shell.context.fs.promises.stat(fullPath);
|
|
66844
|
+
const decoder2 = new TextDecoder();
|
|
66845
|
+
let buffer2 = "";
|
|
66846
|
+
let bytesRead = 0;
|
|
66847
|
+
const chunkSize = 1024;
|
|
66848
|
+
while (bytesRead < stat2.size) {
|
|
66849
|
+
if (interrupted) break;
|
|
66850
|
+
const data = new Uint8Array(chunkSize);
|
|
66851
|
+
const readSize = Math.min(chunkSize, stat2.size - bytesRead);
|
|
66852
|
+
await handle.read(data, 0, readSize, bytesRead);
|
|
66853
|
+
const chunk = data.subarray(0, readSize);
|
|
66854
|
+
buffer2 += decoder2.decode(chunk, { stream: true });
|
|
66855
|
+
bytesRead += readSize;
|
|
66856
|
+
}
|
|
66857
|
+
const lines = buffer2.split("\n");
|
|
66858
|
+
if (lines[lines.length - 1] === "") {
|
|
66859
|
+
lines.pop();
|
|
66860
|
+
}
|
|
66861
|
+
const output2 = lines.slice(-numLines).join("\n");
|
|
66862
|
+
if (output2) {
|
|
66863
|
+
await writer.write(new TextEncoder().encode(output2 + "\n"));
|
|
66864
|
+
}
|
|
66865
|
+
} else {
|
|
66866
|
+
const device = await shell.context.fs.promises.open(fullPath);
|
|
66867
|
+
const decoder2 = new TextDecoder();
|
|
66868
|
+
const lines = [];
|
|
66869
|
+
let buffer2 = "";
|
|
66870
|
+
const chunkSize = 1024;
|
|
66871
|
+
const data = new Uint8Array(chunkSize);
|
|
66872
|
+
let bytesRead = 0;
|
|
66873
|
+
do {
|
|
66874
|
+
if (interrupted) break;
|
|
66875
|
+
const result = await device.read(data);
|
|
66876
|
+
bytesRead = result.bytesRead;
|
|
66877
|
+
if (bytesRead > 0) {
|
|
66878
|
+
buffer2 += decoder2.decode(data.subarray(0, bytesRead), { stream: true });
|
|
66879
|
+
}
|
|
66880
|
+
} while (bytesRead > 0);
|
|
66881
|
+
const allLines = buffer2.split("\n");
|
|
66882
|
+
if (allLines[allLines.length - 1] === "") {
|
|
66883
|
+
allLines.pop();
|
|
66884
|
+
}
|
|
66885
|
+
lines.push(...allLines);
|
|
66886
|
+
const output2 = lines.slice(-numLines).join("\n");
|
|
66887
|
+
if (output2) {
|
|
66888
|
+
await writer.write(new TextEncoder().encode(output2 + "\n"));
|
|
66889
|
+
}
|
|
66890
|
+
}
|
|
66891
|
+
} finally {
|
|
66892
|
+
kernel.terminal.events.off(TerminalEvents.INTERRUPT, interruptHandler);
|
|
66893
|
+
}
|
|
66894
|
+
}
|
|
66895
|
+
return 0;
|
|
66896
|
+
} finally {
|
|
66897
|
+
writer.releaseLock();
|
|
66898
|
+
}
|
|
66899
|
+
}, "run")
|
|
66900
|
+
});
|
|
66901
|
+
}
|
|
66405
66902
|
__name(createCommand, "createCommand");
|
|
66406
66903
|
function createAllCommands(kernel, shell, terminal) {
|
|
66407
66904
|
return {
|
|
66408
|
-
cat: createCommand$
|
|
66409
|
-
cd: createCommand$
|
|
66410
|
-
chmod: createCommand$
|
|
66411
|
-
cp: createCommand$
|
|
66412
|
-
echo: createCommand$
|
|
66413
|
-
|
|
66414
|
-
|
|
66415
|
-
|
|
66416
|
-
|
|
66417
|
-
|
|
66418
|
-
|
|
66419
|
-
|
|
66420
|
-
|
|
66421
|
-
|
|
66422
|
-
|
|
66423
|
-
|
|
66424
|
-
|
|
66425
|
-
|
|
66426
|
-
|
|
66905
|
+
cat: createCommand$l(kernel, shell, terminal),
|
|
66906
|
+
cd: createCommand$k(kernel, shell, terminal),
|
|
66907
|
+
chmod: createCommand$j(kernel, shell, terminal),
|
|
66908
|
+
cp: createCommand$i(kernel, shell, terminal),
|
|
66909
|
+
echo: createCommand$h(kernel, shell, terminal),
|
|
66910
|
+
grep: createCommand$g(kernel, shell, terminal),
|
|
66911
|
+
head: createCommand$f(kernel, shell, terminal),
|
|
66912
|
+
ln: createCommand$e(kernel, shell, terminal),
|
|
66913
|
+
ls: createCommand$d(kernel, shell, terminal),
|
|
66914
|
+
mkdir: createCommand$c(kernel, shell, terminal),
|
|
66915
|
+
mv: createCommand$b(kernel, shell, terminal),
|
|
66916
|
+
pwd: createCommand$a(kernel, shell, terminal),
|
|
66917
|
+
rm: createCommand$9(kernel, shell, terminal),
|
|
66918
|
+
rmdir: createCommand$8(kernel, shell, terminal),
|
|
66919
|
+
stat: createCommand$7(kernel, shell, terminal),
|
|
66920
|
+
touch: createCommand$6(kernel, shell, terminal),
|
|
66921
|
+
hex: createCommand$5(kernel, shell, terminal),
|
|
66922
|
+
less: createCommand$4(kernel, shell, terminal),
|
|
66923
|
+
passkey: createCommand$3(kernel, shell, terminal),
|
|
66924
|
+
sed: createCommand$2(kernel, shell, terminal),
|
|
66925
|
+
tail: createCommand(kernel, shell, terminal),
|
|
66926
|
+
tee: createCommand$1(kernel, shell, terminal)
|
|
66427
66927
|
};
|
|
66428
66928
|
}
|
|
66429
66929
|
__name(createAllCommands, "createAllCommands");
|
|
@@ -66527,7 +67027,7 @@ const TerminalCommands = /* @__PURE__ */ __name((kernel, shell, terminal) => {
|
|
|
66527
67027
|
{ name: "reinstall", type: Boolean, description: "Reinstall the package if it is already installed" }
|
|
66528
67028
|
],
|
|
66529
67029
|
run: /* @__PURE__ */ __name(async (argv) => {
|
|
66530
|
-
const { default: install } = await import("./install-
|
|
67030
|
+
const { default: install } = await import("./install-vHqmAl7t.js");
|
|
66531
67031
|
return await install({ kernel, shell, terminal, args: [argv.package, argv.registry, argv.reinstall] });
|
|
66532
67032
|
}, "run")
|
|
66533
67033
|
}),
|
|
@@ -66542,7 +67042,7 @@ const TerminalCommands = /* @__PURE__ */ __name((kernel, shell, terminal) => {
|
|
|
66542
67042
|
{ name: "package", type: String, typeLabel: "{underline package}", defaultOption: true, description: "The package name and optional version (e.g. package@1.0.0). If no version is specified, all versions will be uninstalled." }
|
|
66543
67043
|
],
|
|
66544
67044
|
run: /* @__PURE__ */ __name(async (argv) => {
|
|
66545
|
-
const { default: uninstall } = await import("./uninstall-
|
|
67045
|
+
const { default: uninstall } = await import("./uninstall-Ds11Scu8.js");
|
|
66546
67046
|
return await uninstall({ kernel, shell, terminal, args: [argv.package] });
|
|
66547
67047
|
}, "run")
|
|
66548
67048
|
}),
|
|
@@ -66913,7 +67413,6 @@ const fetch$1 = /* @__PURE__ */ __name(async ({ shell, terminal, process: proces
|
|
|
66913
67413
|
} finally {
|
|
66914
67414
|
reader.releaseLock();
|
|
66915
67415
|
writer?.releaseLock();
|
|
66916
|
-
await writeStdout(process2, terminal, "\n");
|
|
66917
67416
|
}
|
|
66918
67417
|
return 0;
|
|
66919
67418
|
} catch (error) {
|
|
@@ -67783,11 +68282,14 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
67783
68282
|
async readline(prompt = "", hide = false, noListen = false) {
|
|
67784
68283
|
let input = "";
|
|
67785
68284
|
let cursor = 0;
|
|
67786
|
-
|
|
68285
|
+
const wasListening = this._keyListener !== void 0;
|
|
68286
|
+
this.unlisten();
|
|
67787
68287
|
this.write(prompt);
|
|
67788
68288
|
this.focus();
|
|
67789
68289
|
const result = await new Promise((resolve2) => {
|
|
67790
68290
|
const disposable = this.onKey(({ domEvent }) => {
|
|
68291
|
+
domEvent.preventDefault();
|
|
68292
|
+
domEvent.stopPropagation();
|
|
67791
68293
|
switch (domEvent.key) {
|
|
67792
68294
|
case "Enter":
|
|
67793
68295
|
disposable.dispose();
|
|
@@ -67795,18 +68297,24 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
67795
68297
|
resolve2(input);
|
|
67796
68298
|
break;
|
|
67797
68299
|
case "ArrowLeft":
|
|
67798
|
-
|
|
67799
|
-
|
|
68300
|
+
if (cursor > 0) {
|
|
68301
|
+
this.write(ansi$7.cursor.back());
|
|
68302
|
+
cursor--;
|
|
68303
|
+
}
|
|
67800
68304
|
break;
|
|
67801
68305
|
case "ArrowRight":
|
|
67802
|
-
|
|
67803
|
-
|
|
68306
|
+
if (cursor < input.length) {
|
|
68307
|
+
this.write(ansi$7.cursor.forward());
|
|
68308
|
+
cursor++;
|
|
68309
|
+
}
|
|
67804
68310
|
break;
|
|
67805
68311
|
case "Home":
|
|
67806
|
-
this.write(ansi$7.cursor.horizontalAbsolute(0));
|
|
68312
|
+
this.write(ansi$7.cursor.horizontalAbsolute(prompt.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").length + 1));
|
|
68313
|
+
cursor = 0;
|
|
67807
68314
|
break;
|
|
67808
68315
|
case "End":
|
|
67809
|
-
this.write(ansi$7.cursor.horizontalAbsolute(input.length));
|
|
68316
|
+
this.write(ansi$7.cursor.horizontalAbsolute(prompt.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").length + input.length + 1));
|
|
68317
|
+
cursor = input.length;
|
|
67810
68318
|
break;
|
|
67811
68319
|
case "Escape":
|
|
67812
68320
|
disposable.dispose();
|
|
@@ -67815,19 +68323,35 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
67815
68323
|
case "Backspace":
|
|
67816
68324
|
if (cursor > 0) {
|
|
67817
68325
|
input = input.slice(0, cursor - 1) + input.slice(cursor);
|
|
67818
|
-
|
|
68326
|
+
const promptLen = prompt.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").length;
|
|
68327
|
+
this.write(ansi$7.cursor.horizontalAbsolute(promptLen + 1) + ansi$7.erase.inLine(0) + input);
|
|
68328
|
+
if (cursor < input.length + 1) {
|
|
68329
|
+
this.write(`\x1B[${input.length + 1 - cursor}D`);
|
|
68330
|
+
}
|
|
67819
68331
|
cursor--;
|
|
67820
68332
|
} else this.write("\x07");
|
|
67821
68333
|
break;
|
|
67822
68334
|
case "Delete":
|
|
67823
|
-
if (cursor < input.length)
|
|
68335
|
+
if (cursor < input.length) {
|
|
68336
|
+
input = input.slice(0, cursor) + input.slice(cursor + 1);
|
|
68337
|
+
this.write(ansi$7.erase.inLine(0) + input.slice(cursor));
|
|
68338
|
+
if (input.length - cursor > 0) {
|
|
68339
|
+
this.write(`\x1B[${input.length - cursor}D`);
|
|
68340
|
+
}
|
|
68341
|
+
}
|
|
67824
68342
|
break;
|
|
67825
68343
|
default:
|
|
67826
68344
|
if (domEvent.key.length === 1 && !domEvent.ctrlKey && !domEvent.metaKey && !domEvent.altKey) {
|
|
67827
68345
|
const charCode = domEvent.key.charCodeAt(0);
|
|
67828
68346
|
if (charCode >= 32 && charCode <= 126) {
|
|
67829
68347
|
input = input.slice(0, cursor) + domEvent.key + input.slice(cursor);
|
|
67830
|
-
if (!hide)
|
|
68348
|
+
if (!hide) {
|
|
68349
|
+
const promptLen = prompt.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").length;
|
|
68350
|
+
this.write(ansi$7.cursor.horizontalAbsolute(promptLen + 1) + ansi$7.erase.inLine(0) + input);
|
|
68351
|
+
if (cursor < input.length - 1) {
|
|
68352
|
+
this.write(`\x1B[${input.length - cursor - 1}D`);
|
|
68353
|
+
}
|
|
68354
|
+
}
|
|
67831
68355
|
cursor++;
|
|
67832
68356
|
}
|
|
67833
68357
|
}
|
|
@@ -67836,7 +68360,7 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
67836
68360
|
if (cursor > input.length) cursor = input.length;
|
|
67837
68361
|
});
|
|
67838
68362
|
});
|
|
67839
|
-
if (!noListen) this.listen();
|
|
68363
|
+
if (wasListening && !noListen) this.listen();
|
|
67840
68364
|
return result;
|
|
67841
68365
|
}
|
|
67842
68366
|
spinner(spinner, prefix, suffix) {
|
|
@@ -68042,33 +68566,23 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
68042
68566
|
break;
|
|
68043
68567
|
case "Backspace":
|
|
68044
68568
|
if (this._cursorPosition > 0) {
|
|
68045
|
-
|
|
68569
|
+
const tail = this._cmd.slice(this._cursorPosition);
|
|
68570
|
+
this._cmd = this._cmd.slice(0, this._cursorPosition - 1) + tail;
|
|
68046
68571
|
this._cursorPosition--;
|
|
68047
|
-
this.write("\b");
|
|
68048
|
-
|
|
68049
|
-
|
|
68572
|
+
this.write("\b" + ansi$7.erase.inLine(0) + tail);
|
|
68573
|
+
if (tail.length > 0) {
|
|
68574
|
+
this.write(`\x1B[${tail.length}D`);
|
|
68575
|
+
}
|
|
68050
68576
|
} else this.write("\x07");
|
|
68051
68577
|
break;
|
|
68052
68578
|
case "Delete":
|
|
68053
68579
|
if (this._cursorPosition < this._cmd.length) {
|
|
68054
|
-
|
|
68055
|
-
this.
|
|
68056
|
-
|
|
68057
|
-
|
|
68058
|
-
|
|
68059
|
-
this.write("> " + parts[0] + chalk$2.gray("#" + parts.slice(1).join("#")));
|
|
68060
|
-
} else {
|
|
68061
|
-
this.write("> " + this._cmd);
|
|
68062
|
-
}
|
|
68063
|
-
} else {
|
|
68064
|
-
const parts = this._cmd.split("#");
|
|
68065
|
-
if (parts.length > 1) {
|
|
68066
|
-
this.write(this.prompt() + parts[0] + chalk$2.gray("#" + parts.slice(1).join("#")));
|
|
68067
|
-
} else {
|
|
68068
|
-
this.write(this.prompt() + this._cmd);
|
|
68069
|
-
}
|
|
68580
|
+
const tail = this._cmd.slice(this._cursorPosition + 1);
|
|
68581
|
+
this._cmd = this._cmd.slice(0, this._cursorPosition) + tail;
|
|
68582
|
+
this.write(ansi$7.erase.inLine(0) + tail);
|
|
68583
|
+
if (tail.length > 0) {
|
|
68584
|
+
this.write(`\x1B[${tail.length}D`);
|
|
68070
68585
|
}
|
|
68071
|
-
if (this._cursorPosition < this._cmd.length) this.write(`\x1B[${this._cmd.length - this._cursorPosition}D`);
|
|
68072
68586
|
}
|
|
68073
68587
|
break;
|
|
68074
68588
|
case "ArrowUp":
|
|
@@ -68171,25 +68685,18 @@ const _Terminal = class _Terminal extends xtermExports.Terminal {
|
|
|
68171
68685
|
default:
|
|
68172
68686
|
this._isTabCycling = false;
|
|
68173
68687
|
if (key.length === 1) {
|
|
68688
|
+
const wasAtEnd = this._cursorPosition === this._cmd.length;
|
|
68174
68689
|
this._cmd = this._cmd.slice(0, this._cursorPosition) + key + this._cmd.slice(this._cursorPosition);
|
|
68175
68690
|
this._cursorPosition++;
|
|
68176
|
-
|
|
68177
|
-
|
|
68178
|
-
const parts = this._cmd.split("#");
|
|
68179
|
-
if (parts.length > 1) {
|
|
68180
|
-
this.write("> " + parts[0] + chalk$2.gray("#" + parts.slice(1).join("#")));
|
|
68181
|
-
} else {
|
|
68182
|
-
this.write("> " + this._cmd);
|
|
68183
|
-
}
|
|
68691
|
+
if (wasAtEnd) {
|
|
68692
|
+
this.write(key);
|
|
68184
68693
|
} else {
|
|
68185
|
-
const
|
|
68186
|
-
|
|
68187
|
-
|
|
68188
|
-
|
|
68189
|
-
this.write(this.prompt() + this._cmd);
|
|
68694
|
+
const tail = this._cmd.slice(this._cursorPosition);
|
|
68695
|
+
this.write(key + tail);
|
|
68696
|
+
if (tail.length > 0) {
|
|
68697
|
+
this.write(`\x1B[${tail.length}D`);
|
|
68190
68698
|
}
|
|
68191
68699
|
}
|
|
68192
|
-
if (this._cursorPosition < this._cmd.length) this.write(`\x1B[${this._cmd.length - this._cursorPosition}D`);
|
|
68193
68700
|
}
|
|
68194
68701
|
}
|
|
68195
68702
|
}
|
|
@@ -71039,7 +71546,9 @@ const _Process = class _Process {
|
|
|
71039
71546
|
__publicField(this, "_status", "stopped");
|
|
71040
71547
|
__publicField(this, "_stderr");
|
|
71041
71548
|
__publicField(this, "_stdin");
|
|
71549
|
+
__publicField(this, "_stdinIsTTY");
|
|
71042
71550
|
__publicField(this, "_stdout");
|
|
71551
|
+
__publicField(this, "_stdoutIsTTY");
|
|
71043
71552
|
__publicField(this, "_terminal");
|
|
71044
71553
|
__publicField(this, "_uid");
|
|
71045
71554
|
__publicField(this, "_keepAlive", false);
|
|
@@ -71060,7 +71569,9 @@ const _Process = class _Process {
|
|
|
71060
71569
|
this._terminal = options.terminal || this.kernel.terminal;
|
|
71061
71570
|
this._uid = options.uid;
|
|
71062
71571
|
this._stdin = options.stdin || this.terminal.getInputStream();
|
|
71572
|
+
this._stdinIsTTY = options.stdinIsTTY ?? (options.stdin ? false : true);
|
|
71063
71573
|
this._stdout = options.stdout || this.terminal.stdout || new WritableStream();
|
|
71574
|
+
this._stdoutIsTTY = options.stdoutIsTTY ?? (options.stdout ? false : true);
|
|
71064
71575
|
this._stderr = options.stderr || this.terminal.stderr || new WritableStream();
|
|
71065
71576
|
this._fdtable = new FDTable(this._stdin, this._stdout, this._stderr);
|
|
71066
71577
|
this.kernel.processes.add(this);
|
|
@@ -71107,9 +71618,15 @@ const _Process = class _Process {
|
|
|
71107
71618
|
get stdin() {
|
|
71108
71619
|
return this._stdin;
|
|
71109
71620
|
}
|
|
71621
|
+
get stdinIsTTY() {
|
|
71622
|
+
return this._stdinIsTTY;
|
|
71623
|
+
}
|
|
71110
71624
|
get stdout() {
|
|
71111
71625
|
return this._stdout;
|
|
71112
71626
|
}
|
|
71627
|
+
get stdoutIsTTY() {
|
|
71628
|
+
return this._stdoutIsTTY;
|
|
71629
|
+
}
|
|
71113
71630
|
get terminal() {
|
|
71114
71631
|
return this._terminal;
|
|
71115
71632
|
}
|
|
@@ -71196,6 +71713,8 @@ const _Process = class _Process {
|
|
|
71196
71713
|
shell: this.shell,
|
|
71197
71714
|
terminal: this.terminal,
|
|
71198
71715
|
stdin: this._stdin,
|
|
71716
|
+
stdinIsTTY: this._stdinIsTTY,
|
|
71717
|
+
stdoutIsTTY: this._stdoutIsTTY,
|
|
71199
71718
|
stdout: this._stdout,
|
|
71200
71719
|
stderr: this._stderr,
|
|
71201
71720
|
uid: this.uid
|
|
@@ -71980,6 +72499,7 @@ const _Shell = class _Shell {
|
|
|
71980
72499
|
const isFirstCommand = i === 0;
|
|
71981
72500
|
const isLastCommand = i === commands.length - 1;
|
|
71982
72501
|
let inputStream;
|
|
72502
|
+
let stdinIsTTY = false;
|
|
71983
72503
|
if (isFirstCommand) {
|
|
71984
72504
|
const inputRedirect = redirections.find((r) => r.type === "<");
|
|
71985
72505
|
if (inputRedirect) {
|
|
@@ -71988,14 +72508,17 @@ const _Shell = class _Shell {
|
|
|
71988
72508
|
throw new Error(`File not found: ${sourcePath}`);
|
|
71989
72509
|
}
|
|
71990
72510
|
inputStream = this.createFileReadStream(sourcePath, env2, kernel);
|
|
72511
|
+
stdinIsTTY = false;
|
|
71991
72512
|
} else {
|
|
71992
72513
|
inputStream = this._terminal.getInputStream();
|
|
72514
|
+
stdinIsTTY = true;
|
|
71993
72515
|
}
|
|
71994
72516
|
} else {
|
|
71995
72517
|
if (!prevReadable) {
|
|
71996
72518
|
throw new Error("Pipeline error: missing previous stream");
|
|
71997
72519
|
}
|
|
71998
72520
|
inputStream = prevReadable;
|
|
72521
|
+
stdinIsTTY = false;
|
|
71999
72522
|
}
|
|
72000
72523
|
let outputStream;
|
|
72001
72524
|
let errorStream;
|
|
@@ -72065,17 +72588,20 @@ const _Shell = class _Shell {
|
|
|
72065
72588
|
errorStream = this.createTerminalErrorStream();
|
|
72066
72589
|
}
|
|
72067
72590
|
}
|
|
72068
|
-
|
|
72591
|
+
const stdoutIsTTY = !stdoutRedirect && isLastCommand;
|
|
72592
|
+
pipelineSetup.push({ finalCommand, args, inputStream, stdinIsTTY, outputStream, errorStream, stdoutIsTTY });
|
|
72069
72593
|
}
|
|
72070
72594
|
const commandPromises = pipelineSetup.map(
|
|
72071
|
-
({ finalCommand, args, inputStream, outputStream, errorStream }) => this._kernel.execute({
|
|
72595
|
+
({ finalCommand, args, inputStream, stdinIsTTY, outputStream, errorStream, stdoutIsTTY }) => this._kernel.execute({
|
|
72072
72596
|
command: finalCommand,
|
|
72073
72597
|
args,
|
|
72074
72598
|
kernel: this._kernel,
|
|
72075
72599
|
shell: this,
|
|
72076
72600
|
terminal: this._terminal,
|
|
72077
72601
|
stdin: inputStream,
|
|
72602
|
+
stdinIsTTY,
|
|
72078
72603
|
stdout: outputStream,
|
|
72604
|
+
stdoutIsTTY,
|
|
72079
72605
|
stderr: errorStream
|
|
72080
72606
|
})
|
|
72081
72607
|
);
|
|
@@ -73894,7 +74420,7 @@ const _Workers = class _Workers {
|
|
|
73894
74420
|
};
|
|
73895
74421
|
__name(_Workers, "Workers");
|
|
73896
74422
|
let Workers = _Workers;
|
|
73897
|
-
const __vite_import_meta_env__ = { "AUTHOR": { "name": "Jay Mathis", "email": "code@mathis.network", "url": "https://github.com/mathiscode" }, "BASE_URL": "/", "DESCRIPTION": "ecmaOS: Micro-kernel and framework for web technologies", "DEV": false, "HOMEPAGE": "https://ecmaos.sh", "KNOWN_ISSUES": ["It's best to stick to Chromium-based browsers for the most features", "Keyboard is broken on mobile; ecmaOS is not mobile-friendly at this time", "Don't expect any sort of POSIX compliance at this stage", "Most commands/devices are very basic implementations, not complete reproductions", "stdin/stdout/stderr streams and redirection can be wonky and don't work everywhere, but are coming along", "CTRL-C will return you to a prompt, but doesn't currently interrupt a process", "Lots of unfinished work; watch your step"], "MODE": "production", "NAME": "@ecmaos/kernel", "PROD": true, "REPOSITORY": "https://github.com/ecmaos/ecmaos", "SSR": false, "TIPS": ["If it ever fails to boot, check your logs, try clearing all data, try incognito mode, or try another browser", "You can run some devices that offer a CLI - e.g. '/dev/battery --help'", "Use the 'install' command to install packages - e.g. 'install @ecmaos-apps/news'", "You can install any NPM package - e.g. 'install jquery'", "Use the 'news' command to see the latest news about ecmaOS", "Type 'ls /bin' to see all built-in commands", "Type 'ls /usr/bin' to see all installed commands", "You can set your environment variables in ~/.env (try setting PROMPT to a PS1-like format)", "You can register and login with a passkey: 'passkey register' and 'passkey list'", "Try 'fetch /xkcd-os.sixel'"], "VERSION": "0.6.
|
|
74423
|
+
const __vite_import_meta_env__ = { "AUTHOR": { "name": "Jay Mathis", "email": "code@mathis.network", "url": "https://github.com/mathiscode" }, "BASE_URL": "/", "DESCRIPTION": "ecmaOS: Micro-kernel and framework for web technologies", "DEV": false, "HOMEPAGE": "https://ecmaos.sh", "KNOWN_ISSUES": ["It's best to stick to Chromium-based browsers for the most features", "Keyboard is broken on mobile; ecmaOS is not mobile-friendly at this time", "Don't expect any sort of POSIX compliance at this stage", "Most commands/devices are very basic implementations, not complete reproductions", "stdin/stdout/stderr streams and redirection can be wonky and don't work everywhere, but are coming along", "CTRL-C will return you to a prompt, but doesn't currently interrupt a process", "Lots of unfinished work; watch your step"], "MODE": "production", "NAME": "@ecmaos/kernel", "PROD": true, "REPOSITORY": "https://github.com/ecmaos/ecmaos", "SSR": false, "TIPS": ["If it ever fails to boot, check your logs, try clearing all data, try incognito mode, or try another browser", "You can run some devices that offer a CLI - e.g. '/dev/battery --help'", "Use the 'install' command to install packages - e.g. 'install @ecmaos-apps/news'", "You can install any NPM package - e.g. 'install jquery'", "Use the 'news' command to see the latest news about ecmaOS", "Type 'ls /bin' to see all built-in commands", "Type 'ls /usr/bin' to see all installed commands", "You can set your environment variables in ~/.env (try setting PROMPT to a PS1-like format)", "You can register and login with a passkey: 'passkey register' and 'passkey list'", "Try 'fetch /xkcd-os.sixel'"], "VERSION": "0.6.6", "VITE_APP_SHOW_DEFAULT_LOGIN": "true", "VITE_AUTOLOGIN_PASSWORD": "root", "VITE_AUTOLOGIN_USERNAME": "root", "VITE_BOOT_DISABLE_ISSUES": "true", "VITE_BOOT_DISABLE_LOGO_CONSOLE": "false", "VITE_BOOT_DISABLE_LOGO_FIGLET": "false", "VITE_BOOT_DISABLE_TIPS": "false", "VITE_INITFS": "/initfs.tar.gz", "VITE_KERNEL_INTERVALS_PROC": "1000", "VITE_KERNEL_MODULES": "@ecmaos-modules/boilerplate@0.1.0", "VITE_METAL_SOCKET": "ws://localhost:30445/socket", "VITE_PORT": "30443", "VITE_RECOMMENDED_APPS": "@ecmaos-apps/code,@ecmaos-apps/edit,@ecmaos-apps/ai,@ecmaos-apps/webamp,@ecmaos-apps/news", "XTERM_VERSION": "5.5.0", "ZENFS_VERSION": "2.4.2" };
|
|
73898
74424
|
var define_import_meta_env_AUTHOR_default = { name: "Jay Mathis", email: "code@mathis.network", url: "https://github.com/mathiscode" };
|
|
73899
74425
|
var define_import_meta_env_KNOWN_ISSUES_default = ["It's best to stick to Chromium-based browsers for the most features", "Keyboard is broken on mobile; ecmaOS is not mobile-friendly at this time", "Don't expect any sort of POSIX compliance at this stage", "Most commands/devices are very basic implementations, not complete reproductions", "stdin/stdout/stderr streams and redirection can be wonky and don't work everywhere, but are coming along", "CTRL-C will return you to a prompt, but doesn't currently interrupt a process", "Lots of unfinished work; watch your step"];
|
|
73900
74426
|
var define_import_meta_env_TIPS_default = ["If it ever fails to boot, check your logs, try clearing all data, try incognito mode, or try another browser", "You can run some devices that offer a CLI - e.g. '/dev/battery --help'", "Use the 'install' command to install packages - e.g. 'install @ecmaos-apps/news'", "You can install any NPM package - e.g. 'install jquery'", "Use the 'news' command to see the latest news about ecmaOS", "Type 'ls /bin' to see all built-in commands", "Type 'ls /usr/bin' to see all installed commands", "You can set your environment variables in ~/.env (try setting PROMPT to a PS1-like format)", "You can register and login with a passkey: 'passkey register' and 'passkey list'", "Try 'fetch /xkcd-os.sixel'"];
|
|
@@ -73939,7 +74465,7 @@ const _Kernel = class _Kernel {
|
|
|
73939
74465
|
/** Name of the kernel */
|
|
73940
74466
|
__publicField(this, "name", "@ecmaos/kernel");
|
|
73941
74467
|
/** Version string of the kernel */
|
|
73942
|
-
__publicField(this, "version", "0.6.
|
|
74468
|
+
__publicField(this, "version", "0.6.6");
|
|
73943
74469
|
/** Authentication and authorization service */
|
|
73944
74470
|
__publicField(this, "auth");
|
|
73945
74471
|
/** BIOS module providing low-level functionality */
|
|
@@ -74097,7 +74623,7 @@ const _Kernel = class _Kernel {
|
|
|
74097
74623
|
];
|
|
74098
74624
|
this.terminal.writeln(chalk$2.red.bold(`🐉 ${t2("kernel.experimental", "EXPERIMENTAL")} 🐉`));
|
|
74099
74625
|
this.terminal.writeln(
|
|
74100
|
-
`${this.terminal.createSpecialLink("https://ecmaos.sh", "@ecmaos/kernel")}@${"0.6.
|
|
74626
|
+
`${this.terminal.createSpecialLink("https://ecmaos.sh", "@ecmaos/kernel")}@${"0.6.6"}` + chalk$2.cyan(` [${dependencyLinks.map((link2) => link2.link).join(", ")}]`)
|
|
74101
74627
|
);
|
|
74102
74628
|
this.terminal.writeln(`${t2("kernel.madeBy", "Made with ❤️ by Jay Mathis")} ${this.terminal.createSpecialLink(
|
|
74103
74629
|
define_import_meta_env_AUTHOR_default?.url || "https://github.com/mathiscode",
|
|
@@ -74114,14 +74640,14 @@ const _Kernel = class _Kernel {
|
|
|
74114
74640
|
if (logoFiglet && true) {
|
|
74115
74641
|
console.log(`%c${logoFiglet}`, "color: green");
|
|
74116
74642
|
console.log(`%c${"https://github.com/ecmaos/ecmaos"}`, "color: blue; text-decoration: underline; font-size: 16px");
|
|
74117
|
-
this.log.info(`${"@ecmaos/kernel"} v${"0.6.
|
|
74643
|
+
this.log.info(`${"@ecmaos/kernel"} v${"0.6.6"}`);
|
|
74118
74644
|
}
|
|
74119
74645
|
if (Notification?.permission === "default") Notification.requestPermission();
|
|
74120
74646
|
if (Notification?.permission === "denied") this.log.warn(t2("kernel.permissionNotificationDenied", "Notification permission denied"));
|
|
74121
74647
|
this.intervals.set("title-blink", () => {
|
|
74122
74648
|
globalThis.document.title = globalThis.document.title.includes("_") ? "ecmaos# " : "ecmaos# _";
|
|
74123
74649
|
}, 600);
|
|
74124
|
-
this.toast.success(`${"@ecmaos/kernel"} v${"0.6.
|
|
74650
|
+
this.toast.success(`${"@ecmaos/kernel"} v${"0.6.6"}`);
|
|
74125
74651
|
}
|
|
74126
74652
|
await this.configure({ devices: this.options.devices || DefaultDevices, filesystem: Filesystem.options() });
|
|
74127
74653
|
const requiredPaths = [
|
|
@@ -74590,7 +75116,9 @@ const _Kernel = class _Kernel {
|
|
|
74590
75116
|
terminal: options.terminal || this.terminal,
|
|
74591
75117
|
entry: /* @__PURE__ */ __name(async (params) => await command.run.call(params, params.pid, params.args), "entry"),
|
|
74592
75118
|
stdin: options.stdin,
|
|
75119
|
+
stdinIsTTY: options.stdinIsTTY,
|
|
74593
75120
|
stdout: options.stdout,
|
|
75121
|
+
stdoutIsTTY: options.stdoutIsTTY,
|
|
74594
75122
|
stderr: options.stderr
|
|
74595
75123
|
});
|
|
74596
75124
|
const exitCode = await process2.start();
|
|
@@ -74867,7 +75395,7 @@ const _Kernel = class _Kernel {
|
|
|
74867
75395
|
memory: "?",
|
|
74868
75396
|
platform: navigator.userAgentData?.platform || navigator?.platform || navigator.userAgent,
|
|
74869
75397
|
querystring: location.search,
|
|
74870
|
-
version: `${"@ecmaos/kernel"} ${"0.6.
|
|
75398
|
+
version: `${"@ecmaos/kernel"} ${"0.6.6"}`,
|
|
74871
75399
|
language: navigator.language,
|
|
74872
75400
|
host: location.host,
|
|
74873
75401
|
userAgent: navigator.userAgent,
|
|
@@ -75044,4 +75572,4 @@ export {
|
|
|
75044
75572
|
path$1 as p,
|
|
75045
75573
|
semver as s
|
|
75046
75574
|
};
|
|
75047
|
-
//# sourceMappingURL=kernel-
|
|
75575
|
+
//# sourceMappingURL=kernel-DZB_DlxI.js.map
|