3 ms·
I tried to make a big deal about this in my State of the Word keynote in December 2022: https://wordpress.tv/2023/01/04/matt-mullenweg-state-of-the-word-2022/ h
by photomatt 3y ago
I tried to make a big deal about this in my State of the Word keynote in December 2022: https://wordpress.tv/2023/01/04/matt-mullenweg-state-of-the-word-2022/ https://wordpress.tv/2023/01/04/matt-mullenweg-state-of-the-...
It kind of blew my mind as an engineer to see it work, and know all the layers that had to interact for that to happen.
It's fun to see it blowing up on HN 6 months later! :) Thank you to everyone for checking it out.
- quickthrower2 3y agoNice talk! For anyone curious, 48:33 is the timestamp where Wordpress Playground is introduced
- dboreham 3y agoIt's very interesting to me since I have an interest in porting various hitherto "server-side" applications to run in-browser. Doubly interesting because it's the first real product I've seen running SQLite -- so far I've only seen toy demos. But, wondering about something -- poking around in the code a bit, and realizing I know next to nothing about present-day php, I realized this may be not using the "traditional" SQLite-over-OPFS approach to get persistence? Actually, after a bit more reading it's not clear to me that persistent storage is available yet via Emscripten. And after yet more poking around I found: https://github.com/WordPress/wordpress-playground/issues/19 https://github.com/WordPress/wordpress-playground/issues/19 which I guess means that persistence isn't yet possible for WP in the browser :(
- lioeters 3y agoThere is partial support for persistence, for browsers that have origin private file system (OPFS) implemented. > OPFS is only supported in Chrome-based browsers at the moment like Edge, Android browser. Safari and Firefox users won't be able to benefit from this feature yet Persistent Playground: Sync between MEMFS and OPFS - https://github.com/WordPress/wordpress-playground/pull/546 https://github.com/WordPress/wordpress-playground/pull/546
- dboreham 3y agoVery interesting, but I don't think sync from MEMFS to OPFS will work for my use case :( Is there a reason why using OPFS directly from SQLite doesn't work?
- dmsnell 3y agoThe Playground stores more than the SQLite database in OPFS. This includes things like installed plugins and file uploads and other artifacts brought in during boot. If there's enough interest and time I could imagine support being added to separate these, but for now it's easiest to have a single load and store mechanism for everything. There's a third option supported only in Chrome at the moment which loads a directory from your computer's filesystem, bypassing even OPFS. > using OPFS directly from SQLite doesn't work? not entirely following your question. any way you could reword and explain what you were hoping to accomplish?
- lioeters 3y ago> Is there a reason why using OPFS directly from SQLite doesn't work? I'm guessing this means using SQLite WASM's built-in OPFS integration as described in these articles: - sqlite3 WebAssembly documentation - Persistent Storage Options: OPFS - https://sqlite.org/wasm/doc/trunk/persistence.md#opfs https://sqlite.org/wasm/doc/trunk/persistence.md#opfs - SQLite Wasm in the browser backed by the Origin Private File System - https://developer.chrome.com/blog/sqlite-wasm-in-the-browser-backed-by-the-origin-private-file-system/ https://developer.chrome.com/blog/sqlite-wasm-in-the-browser... Within the Playground, SQLite interacts with the database file in MEMFS only, and the Playground coordinates the syncing from MEMFS to OPFS. https://github.com/WordPress/wordpress-playground/tree/trunk/packages/playground/remote/src/lib/opfs https://github.com/WordPress/wordpress-playground/tree/trunk... The reason for this, I believe, is that the primary use case is/was to have the entire file system in memory, including SQLite's database file. This was the original implementation, and is still the default behavior. Persistence was later added as an optional feature. The good news is that browser support for OPFS seems to be getting better. From the SQLite docs: As of March 2023 the following browsers are known to have the necessary APIs: - Chromium-derived browsers released since approximately mid-2022 - Firefox v111 (March 2023) and later