From acb6a03678258073154f9a3e8d7a4edb949efc9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Thu, 19 Sep 2024 17:05:29 +0200 Subject: [PATCH] Docs: Remove the outdated "data rependencies" page (#1785) ## Motivation for the change, related issues Removes the data dependencies documentation. Playground doesn't use data Emscripten modules anymore, only zip files. --- .../06-wasm-php-data-dependencies.md | 41 ------------------- .../23-architecture/15-wordpress.md | 2 +- .../23-architecture/17-browser-wordpress.md | 2 +- packages/docs/site/redirections.js | 4 -- packages/docs/site/sidebars.js | 3 +- 5 files changed, 3 insertions(+), 49 deletions(-) delete mode 100644 packages/docs/site/docs/developers/23-architecture/06-wasm-php-data-dependencies.md diff --git a/packages/docs/site/docs/developers/23-architecture/06-wasm-php-data-dependencies.md b/packages/docs/site/docs/developers/23-architecture/06-wasm-php-data-dependencies.md deleted file mode 100644 index f34c1eeeaf..0000000000 --- a/packages/docs/site/docs/developers/23-architecture/06-wasm-php-data-dependencies.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -slug: /developers/architecture/wasm-php-data-dependencies ---- - -# Data dependencies (browser version) - -Importing file to PHP by manually calling `writeFile()` would be quite inconvenient. Fortunately, Emscripten provides a "data dependencies" feature. - -Data dependencies consist of a `dependency.data` file and a `dependency.js` loader and can be packaged with the [file_packager.py tool](https://emscripten.org/docs/porting/files/packaging_files.html). - -WordPress Playground also requires wrapping the Emscripten-generated `dependency.js` file in an ES module as follows: - -1. Prepend `export default function(emscriptenPHPModule) {'; ` -2. Prepend `export const dependencyFilename = ''; ` -3. Prepend `export const dependenciesTotalSize = ;` -4. Append `}` - -Be sure to use the `--export-name="emscriptenPHPModule"` file_packager.py option. - -You want the final output to look as follows: - -```js -export const dependenciesTotalSize = 5644199; -export const dependencyFilename = 'dependency.data'; -export default function (emscriptenPHPModule) { - // Emscripten-generated code: - var Module = typeof emscriptenPHPModule !== 'undefined' ? emscriptenPHPModule : {}; - // ... the rest of it ... -} -``` - -Such a constructions enables loading the `dependency.js` as an ES Module using -`import("/dependency.js")`. - -Once it's ready, you can load PHP and your data dependencies as follows: - -```js -const php = await PHP.load('7.4', { - dataModules: [import('/wp.js')], -}); -``` diff --git a/packages/docs/site/docs/developers/23-architecture/15-wordpress.md b/packages/docs/site/docs/developers/23-architecture/15-wordpress.md index 46378c3002..427567fe35 100644 --- a/packages/docs/site/docs/developers/23-architecture/15-wordpress.md +++ b/packages/docs/site/docs/developers/23-architecture/15-wordpress.md @@ -16,7 +16,7 @@ Behind the scenes, the official [SQLite Database Integration](https://github.com ## WordPress in the browser -WordPress Playground ships a [bundled WordPress](/developers/architecture/wasm-php-data-dependencies) that you can use in the browser. It's optimized for size, and the installation wizard is run for you. +You can use any WordPress build in the browser. For convenience and to reduce the data transfer size, WordPress Playground ships a few [minified WordPress releases](https://github.com/WordPress/wordpress-playground/tree/trunk/packages/playground/wordpress-builds) that you can use in the browser. ## WordPress in Node.js diff --git a/packages/docs/site/docs/developers/23-architecture/17-browser-wordpress.md b/packages/docs/site/docs/developers/23-architecture/17-browser-wordpress.md index 912f1a08e7..4f2bc23155 100644 --- a/packages/docs/site/docs/developers/23-architecture/17-browser-wordpress.md +++ b/packages/docs/site/docs/developers/23-architecture/17-browser-wordpress.md @@ -5,7 +5,7 @@ The [web bundler Dockerfile](https://github.com/WordPress/wordpress-playground/b - Makes WordPress run on SQLite using the [official drop-in plugin](https://github.com/WordPress/sqlite-database-integration) as MySQL is unsupported in the browser. - Reduces the WordPress website size from about 70MB to about 10MB, or 5MB compressed. - Runs the WordPress installation wizard. -- Bundles WordPress as a [data dependency](/developers/architecture/wasm-php-data-dependencies) +- Bundles WordPress as a minified zip file. Build a new bundle with `nx bundle-wordpress playground-wordpress-builds --wp-version=`, e.g.: diff --git a/packages/docs/site/redirections.js b/packages/docs/site/redirections.js index c0e1fe7d21..28e3e74096 100644 --- a/packages/docs/site/redirections.js +++ b/packages/docs/site/redirections.js @@ -48,10 +48,6 @@ const redirections = [ to: '/developers/architecture/wasm-php-compiling', from: '/architecture/wasm-php-compiling', }, - { - to: '/developers/architecture/wasm-php-data-dependencies', - from: '/architecture/wasm-php-data-dependencies', - }, { to: '/developers/architecture/wasm-php-filesystem', from: '/architecture/wasm-php-filesystem', diff --git a/packages/docs/site/sidebars.js b/packages/docs/site/sidebars.js index bd33fe756d..53afc818f5 100644 --- a/packages/docs/site/sidebars.js +++ b/packages/docs/site/sidebars.js @@ -47,7 +47,7 @@ const sidebars = { 'main/guides/wordpress-native-ios-app', 'main/guides/for-plugin-developers', 'main/guides/for-theme-developers', - 'main/guides/providing-content-for-your-demo' + 'main/guides/providing-content-for-your-demo', ], }, { @@ -176,7 +176,6 @@ const sidebars = { 'developers/architecture/wasm-php-compiling', 'developers/architecture/wasm-php-javascript-module', 'developers/architecture/wasm-php-filesystem', - 'developers/architecture/wasm-php-data-dependencies', 'developers/architecture/wasm-asyncify', 'developers/architecture/browser-concepts', 'developers/architecture/browser-tab-orchestrates-execution',