@ecmaos/kernel 0.1.1 → 0.1.2
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 +4 -0
- package/dist/assets/{browser-C139fYki.js → browser-DwS0anQc.js} +2 -2
- package/dist/assets/{browser-C139fYki.js.map → browser-DwS0anQc.js.map} +1 -1
- package/dist/assets/{index-DUVr2hDS.js → index-xODqy1dm.js} +78 -18
- package/dist/assets/{index-DUVr2hDS.js.map → index-xODqy1dm.js.map} +1 -1
- package/dist/assets/{topbar.min-B_SrfKMk.js → topbar.min-BGDI2FSe.js} +2 -2
- package/dist/assets/{topbar.min-B_SrfKMk.js.map → topbar.min-BGDI2FSe.js.map} +1 -1
- package/dist/index.html +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -85,15 +85,19 @@ The goal is to create a kernel and supporting apps that tie together modern web
|
|
|
85
85
|
|
|
86
86
|
- `Apps`
|
|
87
87
|
- These are full applications that are developed to work with ecmaOS
|
|
88
|
+
|
|
88
89
|
- `Core`
|
|
89
90
|
- Core modules provide the system's essential functionality; this includes the kernel itself
|
|
91
|
+
|
|
90
92
|
- `Commands`
|
|
91
93
|
- Commands are small utilities that aren't quite full Apps, provided by the shell
|
|
94
|
+
|
|
92
95
|
- `Devices`
|
|
93
96
|
- Devices get loaded on boot, e.g. /dev/bluetooth, /dev/random, /dev/battery, etc.
|
|
94
97
|
- A device can support being "run" by a user, e.g. `# /dev/battery status`
|
|
95
98
|
- Devices may also be directly read/written, and will behave accordingly
|
|
96
99
|
- An individual device module can provide multiple device drivers, e.g. `/dev/usb` provides `/dev/usb-mydevice-0001-0002`
|
|
100
|
+
|
|
97
101
|
- `Utils`
|
|
98
102
|
- Utilities used during development
|
|
99
103
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getDefaultExportFromCjs } from "./index-
|
|
1
|
+
import { g as getDefaultExportFromCjs } from "./index-xODqy1dm.js";
|
|
2
2
|
var browser$2;
|
|
3
3
|
var hasRequiredBrowser;
|
|
4
4
|
function requireBrowser() {
|
|
@@ -20,4 +20,4 @@ const browser$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
20
20
|
export {
|
|
21
21
|
browser$1 as b
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=browser-
|
|
23
|
+
//# sourceMappingURL=browser-DwS0anQc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-
|
|
1
|
+
{"version":3,"file":"browser-DwS0anQc.js","sources":["../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/browser.js"],"sourcesContent":["'use strict';\n\nmodule.exports = function () {\n throw new Error(\n 'ws does not work in the browser. Browser clients must use the native ' +\n 'WebSocket object'\n );\n};\n"],"names":["browser"],"mappings":";;;;;;AAEAA,cAAiB,WAAY;AAC3B,UAAM,IAAI;AAAA,MACR;AAAA,IAED;AAAA,EACF;;;;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -21493,7 +21493,7 @@ class Dom {
|
|
|
21493
21493
|
async topbar(show) {
|
|
21494
21494
|
if (!this._topbar) return;
|
|
21495
21495
|
const { default: topbar } = await __vitePreload(async () => {
|
|
21496
|
-
const { default: topbar2 } = await import("./topbar.min-
|
|
21496
|
+
const { default: topbar2 } = await import("./topbar.min-BGDI2FSe.js").then((n) => n.t);
|
|
21497
21497
|
return { default: topbar2 };
|
|
21498
21498
|
}, true ? [] : void 0);
|
|
21499
21499
|
this._topbarShow = show ?? !this._topbarShow;
|
|
@@ -46169,7 +46169,7 @@ async function createSimpleWebSocket(url) {
|
|
|
46169
46169
|
let WebSocket2;
|
|
46170
46170
|
try {
|
|
46171
46171
|
WebSocket2 = (await __vitePreload(async () => {
|
|
46172
|
-
const { default: __vite_default__ } = await import("./browser-
|
|
46172
|
+
const { default: __vite_default__ } = await import("./browser-DwS0anQc.js").then((n) => n.b);
|
|
46173
46173
|
return { default: __vite_default__ };
|
|
46174
46174
|
}, true ? [] : void 0)).default;
|
|
46175
46175
|
} catch (error) {
|
|
@@ -63786,9 +63786,7 @@ const install = async ({ kernel, terminal, args }) => {
|
|
|
63786
63786
|
let files = [data.module, data.main, data.types].filter(Boolean);
|
|
63787
63787
|
const browserMappings = {};
|
|
63788
63788
|
if (typeof data.browser === "object") {
|
|
63789
|
-
Object.entries(data.browser)
|
|
63790
|
-
browserMappings[key] = value;
|
|
63791
|
-
});
|
|
63789
|
+
for (const [key, value] of Object.entries(data.browser)) browserMappings[key] = value;
|
|
63792
63790
|
files = [...files, ...Object.keys(data.browser)];
|
|
63793
63791
|
} else if (typeof data.browser === "string") {
|
|
63794
63792
|
files.push(data.browser);
|
|
@@ -63834,9 +63832,7 @@ const install = async ({ kernel, terminal, args }) => {
|
|
|
63834
63832
|
}
|
|
63835
63833
|
}
|
|
63836
63834
|
const fileUrl = `${repo}/${packageName}@${data.version}/${targetFile}`;
|
|
63837
|
-
if (browserReplacement) {
|
|
63838
|
-
terminal.writeln(chalk$1.blue(`Remapping ${file} to ${browserReplacement}`));
|
|
63839
|
-
}
|
|
63835
|
+
if (browserReplacement) terminal.writeln(chalk$1.blue(`Remapping ${file} to ${browserReplacement}`));
|
|
63840
63836
|
try {
|
|
63841
63837
|
terminal.writeln(chalk$1.green(`Downloading ${targetFile} to ${filePath}`));
|
|
63842
63838
|
const fileResponse = await globalThis.fetch(fileUrl);
|
|
@@ -68738,11 +68734,15 @@ class Users {
|
|
|
68738
68734
|
}
|
|
68739
68735
|
}
|
|
68740
68736
|
class Wasm {
|
|
68741
|
-
// private _wabt?: WabtModule
|
|
68742
68737
|
constructor(options) {
|
|
68743
68738
|
__publicField(this, "_kernel");
|
|
68739
|
+
__publicField(this, "_modules", /* @__PURE__ */ new Map());
|
|
68744
68740
|
this._kernel = options.kernel;
|
|
68745
68741
|
}
|
|
68742
|
+
// private _wabt?: WabtModule
|
|
68743
|
+
get modules() {
|
|
68744
|
+
return this._modules;
|
|
68745
|
+
}
|
|
68746
68746
|
/**
|
|
68747
68747
|
* Load an emscripten JS file compiled using -sSINGLE_FILE
|
|
68748
68748
|
*/
|
|
@@ -68752,6 +68752,20 @@ class Wasm {
|
|
|
68752
68752
|
script.textContent = contents;
|
|
68753
68753
|
document.head.appendChild(script);
|
|
68754
68754
|
}
|
|
68755
|
+
/**
|
|
68756
|
+
* Load a WebAssembly module
|
|
68757
|
+
*/
|
|
68758
|
+
async loadWasm(path2) {
|
|
68759
|
+
const importObject = {
|
|
68760
|
+
env: {
|
|
68761
|
+
log: console.log
|
|
68762
|
+
}
|
|
68763
|
+
};
|
|
68764
|
+
const wasm = await this._kernel.filesystem.fs.readFile(path2);
|
|
68765
|
+
const { module, instance: instance2 } = await WebAssembly.instantiate(wasm, importObject);
|
|
68766
|
+
this._modules.set(path2, { module, instance: instance2 });
|
|
68767
|
+
return { module, instance: instance2 };
|
|
68768
|
+
}
|
|
68755
68769
|
}
|
|
68756
68770
|
(function() {
|
|
68757
68771
|
var e2, aa = document.createElement("style");
|
|
@@ -75936,7 +75950,7 @@ var createBIOS = (() => {
|
|
|
75936
75950
|
return moduleRtn;
|
|
75937
75951
|
};
|
|
75938
75952
|
})();
|
|
75939
|
-
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": ["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", "Newly created files on any IndexedDB-backed filesystem are not readable until the kernel is restarted", "Lots of unfinished work; watch your step"], "MODE": "production", "NAME": "@ecmaos/kernel", "PROD": true, "REPOSITORY": "https://github.com/ecmaos/ecmaos", "SSR": false, "TIPS": ["You can 'run' some devices that offer a CLI - for example, '/dev/battery --help'"], "VERSION": "0.1.
|
|
75953
|
+
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": ["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", "Newly created files on any IndexedDB-backed filesystem are not readable until the kernel is restarted", "Lots of unfinished work; watch your step"], "MODE": "production", "NAME": "@ecmaos/kernel", "PROD": true, "REPOSITORY": "https://github.com/ecmaos/ecmaos", "SSR": false, "TIPS": ["You can 'run' some devices that offer a CLI - for example, '/dev/battery --help'"], "VERSION": "0.1.1", "VITE_APP_SHOW_DEFAULT_LOGIN": "true", "VITE_PORT": "30443" };
|
|
75940
75954
|
var define_import_meta_env_AUTHOR_default = { name: "Jay Mathis", email: "code@mathis.network", url: "https://github.com/mathiscode" };
|
|
75941
75955
|
var define_import_meta_env_KNOWN_ISSUES_default = ["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", "Newly created files on any IndexedDB-backed filesystem are not readable until the kernel is restarted", "Lots of unfinished work; watch your step"];
|
|
75942
75956
|
var define_import_meta_env_TIPS_default = ["You can 'run' some devices that offer a CLI - for example, '/dev/battery --help'"];
|
|
@@ -75975,36 +75989,67 @@ const DefaultFigletFonts = [
|
|
|
75975
75989
|
];
|
|
75976
75990
|
class Kernel {
|
|
75977
75991
|
constructor(_options = DefaultKernelOptions) {
|
|
75992
|
+
/** Unique identifier for this kernel instance */
|
|
75978
75993
|
__publicField(this, "id", crypto.randomUUID());
|
|
75994
|
+
/** Name of the kernel */
|
|
75979
75995
|
__publicField(this, "name", "@ecmaos/kernel");
|
|
75980
|
-
|
|
75996
|
+
/** Version string of the kernel */
|
|
75997
|
+
__publicField(this, "version", "0.1.1");
|
|
75998
|
+
/** Authentication and authorization service */
|
|
75981
75999
|
__publicField(this, "auth");
|
|
76000
|
+
/** BIOS module providing low-level functionality */
|
|
75982
76001
|
__publicField(this, "bios");
|
|
76002
|
+
/** Broadcast channel for inter-kernel communication */
|
|
75983
76003
|
__publicField(this, "channel");
|
|
76004
|
+
/** Web Components manager */
|
|
75984
76005
|
__publicField(this, "components");
|
|
76006
|
+
/** DOM manipulation service */
|
|
75985
76007
|
__publicField(this, "dom");
|
|
76008
|
+
/** Map of registered devices and their drivers */
|
|
75986
76009
|
__publicField(this, "devices", /* @__PURE__ */ new Map());
|
|
76010
|
+
/** Event management system */
|
|
75987
76011
|
__publicField(this, "events");
|
|
76012
|
+
/** Virtual filesystem */
|
|
75988
76013
|
__publicField(this, "filesystem");
|
|
76014
|
+
/** Internationalization service */
|
|
75989
76015
|
__publicField(this, "i18n");
|
|
76016
|
+
/** Interval management service */
|
|
75990
76017
|
__publicField(this, "intervals");
|
|
76018
|
+
/** Keyboard interface */
|
|
75991
76019
|
__publicField(this, "keyboard");
|
|
76020
|
+
/** Logging system, null if disabled */
|
|
75992
76021
|
__publicField(this, "log");
|
|
76022
|
+
/** Memory management service */
|
|
75993
76023
|
__publicField(this, "memory");
|
|
76024
|
+
/** Configuration options passed to the kernel */
|
|
75994
76025
|
__publicField(this, "options");
|
|
76026
|
+
/** Map of loaded packages */
|
|
75995
76027
|
__publicField(this, "packages", /* @__PURE__ */ new Map());
|
|
76028
|
+
/** Process management service */
|
|
75996
76029
|
__publicField(this, "processes");
|
|
76030
|
+
/** Protocol handler service */
|
|
75997
76031
|
__publicField(this, "protocol");
|
|
76032
|
+
/** Map of available screensavers */
|
|
75998
76033
|
__publicField(this, "screensavers");
|
|
76034
|
+
/** Service management system */
|
|
75999
76035
|
__publicField(this, "service");
|
|
76036
|
+
/** Shell for command interpretation and execution */
|
|
76000
76037
|
__publicField(this, "shell");
|
|
76038
|
+
/** Storage provider interface */
|
|
76001
76039
|
__publicField(this, "storage");
|
|
76040
|
+
/** Terminal interface for user interaction */
|
|
76002
76041
|
__publicField(this, "terminal");
|
|
76042
|
+
/** Toast notification service */
|
|
76003
76043
|
__publicField(this, "toast");
|
|
76044
|
+
/** User management service */
|
|
76004
76045
|
__publicField(this, "users");
|
|
76046
|
+
/** WebAssembly service */
|
|
76005
76047
|
__publicField(this, "wasm");
|
|
76048
|
+
/** Window management service */
|
|
76006
76049
|
__publicField(this, "windows");
|
|
76050
|
+
/** Web Worker management service */
|
|
76007
76051
|
__publicField(this, "workers");
|
|
76052
|
+
/** Current state of the kernel */
|
|
76008
76053
|
__publicField(this, "_state", KernelState.BOOTING);
|
|
76009
76054
|
this.options = { ...DefaultKernelOptions, ..._options };
|
|
76010
76055
|
this.auth = new Auth();
|
|
@@ -76040,9 +76085,11 @@ class Kernel {
|
|
|
76040
76085
|
get state() {
|
|
76041
76086
|
return this._state;
|
|
76042
76087
|
}
|
|
76088
|
+
/** Add an event listener; alias for `events.on` */
|
|
76043
76089
|
get addEventListener() {
|
|
76044
76090
|
return this.events.on;
|
|
76045
76091
|
}
|
|
76092
|
+
/** Remove an event listener; alias for `events.off` */
|
|
76046
76093
|
get removeEventListener() {
|
|
76047
76094
|
return this.events.off;
|
|
76048
76095
|
}
|
|
@@ -76098,7 +76145,7 @@ class Kernel {
|
|
|
76098
76145
|
figlet.parseFont(figletFont || "Poison", loadedFont.default);
|
|
76099
76146
|
const logoFiglet = figlet.textSync(__vite_import_meta_env__["FIGLET_TEXT"] || "ECMAOS", { font: figletFont });
|
|
76100
76147
|
this.terminal.writeln(colorFiglet(figletColor, logoFiglet));
|
|
76101
|
-
this.terminal.writeln(`${this.terminal.createSpecialLink("https://ecmaos.sh", "@ecmaos/kernel")} v${"0.1.
|
|
76148
|
+
this.terminal.writeln(`${this.terminal.createSpecialLink("https://ecmaos.sh", "@ecmaos/kernel")} v${"0.1.1"}`);
|
|
76102
76149
|
this.terminal.writeln(`${t2("kernel.madeBy")} ${this.terminal.createSpecialLink(
|
|
76103
76150
|
(define_import_meta_env_AUTHOR_default == null ? void 0 : define_import_meta_env_AUTHOR_default.url) || "https://github.com/mathiscode",
|
|
76104
76151
|
`${define_import_meta_env_AUTHOR_default == null ? void 0 : define_import_meta_env_AUTHOR_default.name} <${define_import_meta_env_AUTHOR_default == null ? void 0 : define_import_meta_env_AUTHOR_default.email}>`
|
|
@@ -76116,14 +76163,14 @@ class Kernel {
|
|
|
76116
76163
|
spinner = this.terminal.spinner("arrow3", chalk$1.yellow(this.i18n.t("Booting")));
|
|
76117
76164
|
spinner.start();
|
|
76118
76165
|
console.log(`%c${logoFiglet}`, "color: green");
|
|
76119
|
-
console.log("
|
|
76120
|
-
this.log.info(`${"@ecmaos/kernel"} v${"0.1.
|
|
76166
|
+
console.log(`%c${"https://github.com/ecmaos/ecmaos"}`, "color: blue; text-decoration: underline; font-size: 16px");
|
|
76167
|
+
this.log.info(`${"@ecmaos/kernel"} v${"0.1.1"}`);
|
|
76121
76168
|
if ((Notification == null ? void 0 : Notification.permission) === "default") Notification.requestPermission();
|
|
76122
76169
|
if ((Notification == null ? void 0 : Notification.permission) === "denied") (_b2 = this.log) == null ? void 0 : _b2.warn(t2("kernel.permissionNotificationDenied"));
|
|
76123
76170
|
this.intervals.set("title-blink", () => {
|
|
76124
76171
|
globalThis.document.title = globalThis.document.title.includes("_") ? "ecmaos# " : "ecmaos# _";
|
|
76125
76172
|
}, 600);
|
|
76126
|
-
this.toast.success(`${"@ecmaos/kernel"} v${"0.1.
|
|
76173
|
+
this.toast.success(`${"@ecmaos/kernel"} v${"0.1.1"}`);
|
|
76127
76174
|
}
|
|
76128
76175
|
await this.configure({ filesystem: Filesystem.options() });
|
|
76129
76176
|
const requiredPaths = [
|
|
@@ -76210,12 +76257,23 @@ class Kernel {
|
|
|
76210
76257
|
Object.assign(credentials, cred);
|
|
76211
76258
|
} else {
|
|
76212
76259
|
if (true) this.terminal.writeln("Default Login: root / root\n");
|
|
76260
|
+
this.terminal.writeln(`${Intl.DateTimeFormat(this.memory.config.get("locale") || "en-US", {
|
|
76261
|
+
year: "numeric",
|
|
76262
|
+
month: "2-digit",
|
|
76263
|
+
day: "2-digit",
|
|
76264
|
+
hour: "2-digit",
|
|
76265
|
+
minute: "2-digit",
|
|
76266
|
+
second: "2-digit"
|
|
76267
|
+
}).format(/* @__PURE__ */ new Date())}`);
|
|
76268
|
+
const issue = await this.filesystem.fs.exists("/etc/issue") ? await this.filesystem.fs.readFile("/etc/issue", "utf-8") : null;
|
|
76269
|
+
if (issue) this.terminal.writeln(issue);
|
|
76213
76270
|
while (true) {
|
|
76214
76271
|
try {
|
|
76215
76272
|
const username = await this.terminal.readline(`👤 ${this.i18n.t("Username")}: `);
|
|
76216
76273
|
const password = await this.terminal.readline(`🔒 ${this.i18n.t("Password")}: `, true);
|
|
76217
76274
|
const { cred } = await this.users.login(username, password);
|
|
76218
76275
|
Object.assign(credentials, cred);
|
|
76276
|
+
this.shell.credentials = cred;
|
|
76219
76277
|
break;
|
|
76220
76278
|
} catch (err2) {
|
|
76221
76279
|
console.error(err2);
|
|
@@ -76223,6 +76281,8 @@ class Kernel {
|
|
|
76223
76281
|
}
|
|
76224
76282
|
}
|
|
76225
76283
|
}
|
|
76284
|
+
const motd = await this.filesystem.fs.exists("/etc/motd") ? await this.filesystem.fs.readFile("/etc/motd", "utf-8") : null;
|
|
76285
|
+
if (motd) this.terminal.writeln("\n" + motd);
|
|
76226
76286
|
const user2 = this.users.get(credentials.uid ?? 0);
|
|
76227
76287
|
if (!user2) throw new Error(t2("kernel.userNotFound"));
|
|
76228
76288
|
this.shell.cwd = user2.uid === 0 ? "/" : user2.home || "/";
|
|
@@ -76593,7 +76653,7 @@ class Kernel {
|
|
|
76593
76653
|
memory: "?",
|
|
76594
76654
|
platform: ((_a3 = navigator.userAgentData) == null ? void 0 : _a3.platform) || (navigator == null ? void 0 : navigator.platform) || navigator.userAgent,
|
|
76595
76655
|
querystring: location.search,
|
|
76596
|
-
version: `${"@ecmaos/kernel"} ${"0.1.
|
|
76656
|
+
version: `${"@ecmaos/kernel"} ${"0.1.1"}`,
|
|
76597
76657
|
language: navigator.language,
|
|
76598
76658
|
host: location.host,
|
|
76599
76659
|
userAgent: navigator.userAgent,
|
|
@@ -76651,7 +76711,7 @@ globalThis.kernel = new Kernel({
|
|
|
76651
76711
|
credentials: void 0,
|
|
76652
76712
|
dom: { topbar: true },
|
|
76653
76713
|
log: { name: `ecmaos:${"kernel"}` },
|
|
76654
|
-
socket:
|
|
76714
|
+
socket: void 0
|
|
76655
76715
|
});
|
|
76656
76716
|
globalThis.kernel.terminal.mount(document.getElementById("terminal"));
|
|
76657
76717
|
globalThis.kernel.boot({ silent: false, figletFontRandom: false });
|
|
@@ -76664,4 +76724,4 @@ const empty = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
76664
76724
|
export {
|
|
76665
76725
|
getDefaultExportFromCjs$2 as g
|
|
76666
76726
|
};
|
|
76667
|
-
//# sourceMappingURL=index-
|
|
76727
|
+
//# sourceMappingURL=index-xODqy1dm.js.map
|