holzschu / a-shell

A terminal for iOS, with multiple windows
BSD 3-Clause "New" or "Revised" License
2.64k stars 116 forks source link

How does JavaScriptCore works? #632

Open HeavySnowJakarta opened 1 year ago

HeavySnowJakarta commented 1 year ago

I've never met WebAssembly before. For its relation with JavaScript, I would like to research on JavaScriptCore first. For JavaScriptCore I have these problems:

holzschu commented 1 year ago

I'm not an expert myself, but this comment contains more explanation: https://github.com/holzschu/a-shell/issues/281#issuecomment-1508933511

I dont't think I can answer all your questions, but I can give more context.

I hope this helps you. Keep in mind that I'm not an expert in JavaScript. I only learned about it in order to make the terminal run.

HeavySnowJakarta commented 1 year ago

For all questions related to node.js, the short answer is "I don't know". In theory, it should be possible to port npm and install JS packages. I had a look at some point, but the source code of npm is hard to find, and the documentation basically assumes that you already have node running. Porting node is a lot of work (each new language is a lot of work, but node is also poorly documented. Almost all of the documentation assumes you already have node, which brings a chicken-and-egg problem).

If you want to import pure node, you may consider #611 which gives some ways to import it to iOS Apps. If you want to let jsc do what node does, it'll be much more challenging.

For all questions related to front-end projects, the answer is also "I don't know (but it's unlikely)". a-Shell is designed for command-line interface. You can maybe tweak it to run front-end projects, but you will likely encounter issues related to user interface.

For view I noticed, I guess if a front-end web page can be packed to be "pure", just like saved web pages with a computer, which includes all src files to execute, but not designed to run on a server. In this case, it's not the JavaScript environment but WebKit (or call it Safari-inside) that works. I know it can view simple HTML files, but I'm not clear if more complex projects work.

Blink is more radical with it. It's terminal user interface can be turned to a Web interface. With it websites can be shown, vscode.dev for example.

But now it's not an essential thing obviously. At least we can run a "server" and use Safari to run it locally once location tracking is provided. If code-server is proved to work some day, you can submit another App like Carnets with a built-in experience and out-of-box experience.