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:
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.
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.
Local Packages: Use the File System API to poll permitted directories periodically.
Settings: Store in LocalStorage?
Implications
No more installing or maintenance of desktop versions -> instant support of all platforms through current browsers.
Updates are automatic.
WebWriter itself could be referenced in each WebWriter document (esbuild-wasm + webwriter-core.js + webwriter-core.css) and documents could be edited on the fly. This is powerful for adoption since the tool spreads with the documents.
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:
npm-in-browser
can be used to fully install packages in the OPFS, but this requires an adapter for bothnpm-in-browser
andesbuild
to access the OPFS. B) Alternatively, dependencies could be loaded by the browser by creating animportmap
out of all packages'package.json
files. Then, in editing mode, all dependencies are directly fetched fromesm.run
. For bundling, dependencies can be fetched foresbuild
. Bundles could be cached in the OPFS. This second solution would eliminate the need for an NPM client, but depend on an external CDN.Implications
esbuild-wasm
+webwriter-core.js
+webwriter-core.css
) and documents could be edited on the fly. This is powerful for adoption since the tool spreads with the documents.