webwriter-app / webwriter

Authoring tool for interactive content
https://webwriter.app
Other
15 stars 1 forks source link

WebWriter in the browser #70

Open salmenf opened 2 months ago

salmenf commented 2 months ago

Idea

To offer WebWriter in the browser, an environment needs to be created as an adapter between WebWriter Core and the browser. This has several challenges:

  1. Saving/Loading: The file system API can be leveraged - A file opened by the user can be overwritten without user input by the application, the rest is accomplished with the built-in file pickers.
  2. Bundling: Esbuild has a WebAssembly version which can be loaded. The issue is in resolving dependencies as the file system cannot be accessed. There are two possible solutions: A) npm-in-browser can be used to fully install packages in the OPFS, but this requires an adapter for both npm-in-browser and esbuild to access the OPFS. B) Alternatively, dependencies could be loaded by the browser by creating an importmap out of all packages' package.json files. Then, in editing mode, all dependencies are directly fetched from esm.run. For bundling, dependencies can be fetched for esbuild. Bundles could be cached in the OPFS. This second solution would eliminate the need for an NPM client, but depend on an external CDN.
  3. Local Packages: Use the File System API to poll permitted directories periodically.
  4. Settings: Store in LocalStorage?

Implications