@wp-playground/wordpress 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@php-wasm/util"),p=require("@wp-playground/common"),_=require("@php-wasm/logger"),d=require("@php-wasm/universal"),T=`<?php
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@php-wasm/util"),p=require("@wp-playground/common"),c=require("@php-wasm/logger"),d=require("@php-wasm/universal"),S=`<?php
2
2
 
3
3
  /**
4
4
  * Rewrites the wp-config.php file to ensure specific constants are defined
@@ -343,8 +343,8 @@ function skip_whitespace($tokens) {
343
343
  }
344
344
  return $output;
345
345
  }
346
- `;async function c(e,r,n,t="rewrite"){const i=o.phpVars({wpConfigPath:r,constants:n,whenAlreadyDefined:t});if((await e.run({code:`<?php ob_start(); ?>
347
- ${T}
346
+ `;async function _(e,r,n,t="rewrite"){const i=o.phpVars({wpConfigPath:r,constants:n,whenAlreadyDefined:t});if((await e.run({code:`<?php ob_start(); ?>
347
+ ${S}
348
348
  $wp_config_path = ${i.wpConfigPath};
349
349
  $wp_config = file_get_contents($wp_config_path);
350
350
  $new_wp_config = rewrite_wp_config_to_define_constants($wp_config, ${i.constants}, ${i.whenAlreadyDefined});
@@ -352,7 +352,7 @@ function skip_whitespace($tokens) {
352
352
  ob_clean();
353
353
  echo false === $return_value ? '0' : '1';
354
354
  ob_end_flush();
355
- `})).text!=="1")throw new Error("Failed to rewrite constants in wp-config.php.")}async function h(e,r){const n=o.joinPaths(r,"wp-config.php"),t={DB_NAME:"wordpress"};!e.fileExists(n)&&e.fileExists(o.joinPaths(r,"wp-config-sample.php"))&&await e.writeFile(n,await e.readFileAsBuffer(o.joinPaths(r,"wp-config-sample.php"))),await c(e,n,t,"skip")}async function S(e){var t,i;const r=await g(e),n=await r.getPrimaryPhp();if((t=e.hooks)!=null&&t.beforeWordPressFiles&&await e.hooks.beforeWordPressFiles(n),e.wordPressZip&&await k(n,await e.wordPressZip),e.constants)for(const s in e.constants)n.defineConstant(s,e.constants[s]);if(e.dataSqlPath&&(n.defineConstant("DB_DIR",o.dirname(e.dataSqlPath)),n.defineConstant("DB_FILE",o.basename(e.dataSqlPath))),n.defineConstant("WP_HOME",e.siteUrl),n.defineConstant("WP_SITEURL",e.siteUrl),await h(n,r.documentRoot),(i=e.hooks)!=null&&i.beforeDatabaseSetup&&await e.hooks.beforeDatabaseSetup(n),e.sqliteIntegrationPluginZip&&await P(n,await e.sqliteIntegrationPluginZip),!e.dataSqlPath&&(await f(n)||await R(n),!await f(n)))throw new Error("WordPress installation has failed.");return r}async function g(e){const r=e.spawnHandler??d.sandboxedSpawnHandlerFactory;async function n(i,s){const a=new d.PHP(await e.createPhpRuntime());return e.sapiName&&a.setSapiName(e.sapiName),i&&(a.requestHandler=i),e.phpIniEntries&&d.setPhpIniEntries(a,e.phpIniEntries),s?(await b(a),await d.writeFiles(a,"/",e.createFiles||{}),await y(a,o.joinPaths(new URL(e.siteUrl).pathname,"phpinfo.php"))):d.proxyFileSystem(await i.getPrimaryPhp(),a,["/tmp",i.documentRoot,"/internal/shared"]),r&&await a.setSpawnHandler(r(i.processManager)),d.rotatePHPRuntime({php:a,cwd:i.documentRoot,recreateRuntime:e.createPhpRuntime,maxRequests:400}),e.onPHPInstanceCreated&&await e.onPHPInstanceCreated(a),a}const t=new d.PHPRequestHandler({phpFactory:async({isPrimary:i})=>n(t,i),documentRoot:e.documentRoot||"/wordpress",absoluteUrl:e.siteUrl,rewriteRules:m,getFileNotFoundAction:e.getFileNotFoundAction??$,cookieStore:e.cookieStore});return t}async function f(e){return(await e.run({code:`<?php
355
+ `})).text!=="1")throw new Error("Failed to rewrite constants in wp-config.php.")}async function h(e,r){const n=o.joinPaths(r,"wp-config.php"),t={DB_NAME:"wordpress"};!e.fileExists(n)&&e.fileExists(o.joinPaths(r,"wp-config-sample.php"))&&await e.writeFile(n,await e.readFileAsBuffer(o.joinPaths(r,"wp-config-sample.php"))),await _(e,n,t,"skip")}async function T(e){var t,i;const r=await g(e),n=await r.getPrimaryPhp();if((t=e.hooks)!=null&&t.beforeWordPressFiles&&await e.hooks.beforeWordPressFiles(n),e.wordPressZip&&await k(n,await e.wordPressZip),e.constants)for(const s in e.constants)n.defineConstant(s,e.constants[s]);if(e.dataSqlPath&&(n.defineConstant("DB_DIR",o.dirname(e.dataSqlPath)),n.defineConstant("DB_FILE",o.basename(e.dataSqlPath))),n.defineConstant("WP_HOME",e.siteUrl),n.defineConstant("WP_SITEURL",e.siteUrl),await h(n,r.documentRoot),(i=e.hooks)!=null&&i.beforeDatabaseSetup&&await e.hooks.beforeDatabaseSetup(n),e.sqliteIntegrationPluginZip&&await y(n,await e.sqliteIntegrationPluginZip),!e.dataSqlPath&&(await f(n)||await R(n),!await f(n)))throw new Error("WordPress installation has failed.");return r}async function g(e){const r=e.spawnHandler??d.sandboxedSpawnHandlerFactory;async function n(i,s){const a=new d.PHP(await e.createPhpRuntime());return e.sapiName&&a.setSapiName(e.sapiName),i&&(a.requestHandler=i),e.phpIniEntries&&d.setPhpIniEntries(a,e.phpIniEntries),s?(await b(a),await d.writeFiles(a,"/",e.createFiles||{}),await P(a,o.joinPaths(new URL(e.siteUrl).pathname,"phpinfo.php"))):d.proxyFileSystem(await i.getPrimaryPhp(),a,["/tmp",i.documentRoot,"/internal/shared"]),r&&await a.setSpawnHandler(r(i.processManager)),d.rotatePHPRuntime({php:a,cwd:i.documentRoot,recreateRuntime:e.createPhpRuntime,maxRequests:400}),e.onPHPInstanceCreated&&await e.onPHPInstanceCreated(a),a}const t=new d.PHPRequestHandler({phpFactory:async({isPrimary:i})=>n(t,i),documentRoot:e.documentRoot||"/wordpress",absoluteUrl:e.siteUrl,rewriteRules:m,getFileNotFoundAction:e.getFileNotFoundAction??$,cookieStore:e.cookieStore});return t}async function f(e){return(await e.run({code:`<?php
356
356
  ob_start();
357
357
  $wp_load = getenv('DOCUMENT_ROOT') . '/wp-load.php';
358
358
  if (!file_exists($wp_load)) {
@@ -378,7 +378,7 @@ function skip_whitespace($tokens) {
378
378
  ob_clean();
379
379
  echo $option_result ? '1' : '0';
380
380
  ob_end_flush();
381
- `,env:{DOCUMENT_ROOT:e.documentRoot}})).text!=="1"&&_.logger.warn("Failed to default to pretty permalinks after WP install.")}function $(e){return{type:"internal-redirect",uri:"/index.php"}}async function v(e){const{php:r,reap:n}=await e.processManager.acquirePHPInstance({considerPrimary:!0});try{const i=(await r.run({code:`<?php
381
+ `,env:{DOCUMENT_ROOT:e.documentRoot}})).text!=="1"&&c.logger.warn("Failed to default to pretty permalinks after WP install.")}function $(e){return{type:"internal-redirect",uri:"/index.php"}}async function v(e){const{php:r,reap:n}=await e.processManager.acquirePHPInstance({considerPrimary:!0});try{const i=(await r.run({code:`<?php
382
382
  require '${e.documentRoot}/wp-includes/version.php';
383
383
  echo $wp_version;
384
384
  `})).text;if(!i)throw new Error("Unable to read loaded WordPress version.");return w(i)}finally{n()}}function w(e){if(/-(alpha|beta|RC)\d*-\d+$/.test(e))return"nightly";if(/-(beta|RC)\d*$/.test(e))return"beta";const t=e.match(/^(\d+\.\d+)(?:\.\d+)?$/);return t!==null?t[1]:e}const m=[{match:/^\/(.*?)(\/wp-(content|admin|includes)\/.*)/g,replacement:"$2"}];async function b(e){await e.mkdir("/internal/shared/mu-plugins"),await e.writeFile("/internal/shared/preload/env.php",`<?php
@@ -609,13 +609,13 @@ function skip_whitespace($tokens) {
609
609
  }
610
610
  return false;
611
611
  });
612
- })();`)}async function y(e,r="/phpinfo.php"){await e.writeFile("/internal/shared/preload/phpinfo.php",`<?php
612
+ })();`)}async function P(e,r="/phpinfo.php"){await e.writeFile("/internal/shared/preload/phpinfo.php",`<?php
613
613
  // Render PHPInfo if the requested page is /phpinfo.php
614
614
  if ( isset($_SERVER['REQUEST_URI']) && ${o.phpVar(r)} === $_SERVER['REQUEST_URI'] ) {
615
615
  phpinfo();
616
616
  exit;
617
617
  }
618
- `)}async function P(e,r){await e.isDir("/tmp/sqlite-database-integration")&&await e.rmdir("/tmp/sqlite-database-integration",{recursive:!0}),await e.mkdir("/tmp/sqlite-database-integration"),await p.unzipFile(e,r,"/tmp/sqlite-database-integration");const n="/internal/shared/sqlite-database-integration",t=`/tmp/sqlite-database-integration/${(await e.listFiles("/tmp/sqlite-database-integration"))[0]}`;await e.mv(t,n),e.defineConstant("WP_SQLITE_AST_DRIVER",!0),await e.defineConstant("SQLITE_MAIN_FILE","1");const s=(await e.readFileAsText(o.joinPaths(n,"db.copy"))).replace("'{SQLITE_IMPLEMENTATION_FOLDER_PATH}'",o.phpVar(n)).replace("'{SQLITE_PLUGIN}'",o.phpVar(o.joinPaths(n,"load.php"))),a=o.joinPaths(await e.documentRoot,"wp-content/db.php"),l=`<?php
618
+ `)}async function y(e,r){await e.isDir("/tmp/sqlite-database-integration")&&await e.rmdir("/tmp/sqlite-database-integration",{recursive:!0}),await e.mkdir("/tmp/sqlite-database-integration"),await p.unzipFile(e,r,"/tmp/sqlite-database-integration");const n="/internal/shared/sqlite-database-integration",t=`/tmp/sqlite-database-integration/${(await e.listFiles("/tmp/sqlite-database-integration"))[0]}`;await e.mv(t,n),e.defineConstant("WP_SQLITE_AST_DRIVER",!0),await e.defineConstant("SQLITE_MAIN_FILE","1");const s=(await e.readFileAsText(o.joinPaths(n,"db.copy"))).replace("'{SQLITE_IMPLEMENTATION_FOLDER_PATH}'",o.phpVar(n)).replace("'{SQLITE_PLUGIN}'",o.phpVar(o.joinPaths(n,"load.php"))),a=o.joinPaths(await e.documentRoot,"wp-content/db.php"),l=`<?php
619
619
  // Do not preload this if WordPress comes with a custom db.php file.
620
620
  if(file_exists(${o.phpVar(a)})) {
621
621
  return;
@@ -673,6 +673,15 @@ class Playground_SQLite_Integration_Loader {
673
673
  require_once ${o.phpVar(u)};
674
674
  }
675
675
  }
676
+ /**
677
+ * The Query Monitor plugin short-circuits in the CLI SAPI. However, in Playground,
678
+ * the SAPI is always "cli" at the moment. Let's set a constant to disable the CLI
679
+ * detection.
680
+ *
681
+ * @see https://github.com/WordPress/sqlite-database-integration/pull/212
682
+ * @see https://github.com/WordPress/sqlite-database-integration/pull/215
683
+ */
684
+ define('QM_TESTS', true);
676
685
  $wpdb = $GLOBALS['wpdb'] = new Playground_SQLite_Integration_Loader();
677
686
 
678
687
  /**
@@ -692,5 +701,5 @@ if(!function_exists('mysqli_connect')) {
692
701
  var_dump(isset($wpdb));
693
702
  die("SQLite integration not loaded " . get_class($wpdb));
694
703
  }
695
- `)}async function k(e,r){e.mkdir("/tmp/unzipped-wordpress"),await p.unzipFile(e,r,"/tmp/unzipped-wordpress"),e.fileExists("/tmp/unzipped-wordpress/wordpress.zip")&&await p.unzipFile(e,"/tmp/unzipped-wordpress/wordpress.zip","/tmp/unzipped-wordpress");let n=e.fileExists("/tmp/unzipped-wordpress/wordpress")?"/tmp/unzipped-wordpress/wordpress":e.fileExists("/tmp/unzipped-wordpress/build")?"/tmp/unzipped-wordpress/build":"/tmp/unzipped-wordpress";if(!e.fileExists(o.joinPaths(n,"wp-config-sample.php"))){const i=e.listFiles(n);if(i.length){const s=i[0];e.fileExists(o.joinPaths(n,s,"wp-config-sample.php"))&&(n=o.joinPaths(n,s))}}const t=(i,s,a)=>{if(a.isDir(i)&&a.isDir(s))for(const l of a.listFiles(i)){const u=o.joinPaths(i,l),E=o.joinPaths(s,l);t(u,E,a)}else{if(a.fileExists(s)){const l=i.replace(/^\/tmp\/unzipped-wordpress\//,"/");_.logger.warn(`Skipping ${l} because something exists at the target path.`);return}a.mv(i,s)}};t(n,e.documentRoot,e),e.fileExists(n)&&e.rmdir(n,{recursive:!0}),!e.fileExists(o.joinPaths(e.documentRoot,"wp-config.php"))&&e.fileExists(o.joinPaths(e.documentRoot,"wp-config-sample.php"))&&e.writeFile(o.joinPaths(e.documentRoot,"wp-config.php"),e.readFileAsText(o.joinPaths(e.documentRoot,"/wp-config-sample.php")))}const L=p.createMemoizedFetch(fetch);async function x(e="latest"){if(e.startsWith("https://")||e.startsWith("http://")){const t=await crypto.subtle.digest("SHA-1",new TextEncoder().encode(e)),i=Array.from(new Uint8Array(t)).map(s=>s.toString(16).padStart(2,"0")).join("");return{releaseUrl:e,version:"custom-"+i.substring(0,8),source:"inferred"}}else if(e==="trunk"||e==="nightly")return{releaseUrl:"https://wordpress.org/nightly-builds/wordpress-latest.zip",version:"nightly-"+new Date().toISOString().split("T")[0],source:"inferred"};let n=await(await L("https://api.wordpress.org/core/version-check/1.7/?channel=beta")).json();n=n.offers.filter(t=>t.response==="autoupdate");for(const t of n){if(e==="beta"&&t.version.includes("beta"))return{releaseUrl:t.download,version:t.version,source:"api"};if(e==="latest"&&!t.version.includes("beta"))return{releaseUrl:t.download,version:t.version,source:"api"};if(t.version.substring(0,e.length)===e)return{releaseUrl:t.download,version:t.version,source:"api"}}return{releaseUrl:`https://wordpress.org/wordpress-${e}.zip`,version:e,source:"inferred"}}exports.bootRequestHandler=g;exports.bootWordPress=S;exports.defineWpConfigConstants=c;exports.ensureWpConfig=h;exports.getFileNotFoundActionForWordPress=$;exports.getLoadedWordPressVersion=v;exports.preloadPhpInfoRoute=y;exports.preloadSqliteIntegration=P;exports.resolveWordPressRelease=x;exports.setupPlatformLevelMuPlugins=b;exports.unzipWordPress=k;exports.versionStringToLoadedWordPressVersion=w;exports.wordPressRewriteRules=m;
704
+ `)}async function k(e,r){e.mkdir("/tmp/unzipped-wordpress"),await p.unzipFile(e,r,"/tmp/unzipped-wordpress"),e.fileExists("/tmp/unzipped-wordpress/wordpress.zip")&&await p.unzipFile(e,"/tmp/unzipped-wordpress/wordpress.zip","/tmp/unzipped-wordpress");let n=e.fileExists("/tmp/unzipped-wordpress/wordpress")?"/tmp/unzipped-wordpress/wordpress":e.fileExists("/tmp/unzipped-wordpress/build")?"/tmp/unzipped-wordpress/build":"/tmp/unzipped-wordpress";if(!e.fileExists(o.joinPaths(n,"wp-config-sample.php"))){const i=e.listFiles(n);if(i.length){const s=i[0];e.fileExists(o.joinPaths(n,s,"wp-config-sample.php"))&&(n=o.joinPaths(n,s))}}const t=(i,s,a)=>{if(a.isDir(i)&&a.isDir(s))for(const l of a.listFiles(i)){const u=o.joinPaths(i,l),E=o.joinPaths(s,l);t(u,E,a)}else{if(a.fileExists(s)){const l=i.replace(/^\/tmp\/unzipped-wordpress\//,"/");c.logger.warn(`Skipping ${l} because something exists at the target path.`);return}a.mv(i,s)}};t(n,e.documentRoot,e),e.fileExists(n)&&e.rmdir(n,{recursive:!0}),!e.fileExists(o.joinPaths(e.documentRoot,"wp-config.php"))&&e.fileExists(o.joinPaths(e.documentRoot,"wp-config-sample.php"))&&e.writeFile(o.joinPaths(e.documentRoot,"wp-config.php"),e.readFileAsText(o.joinPaths(e.documentRoot,"/wp-config-sample.php")))}const L=p.createMemoizedFetch(fetch);async function x(e="latest"){if(e.startsWith("https://")||e.startsWith("http://")){const t=await crypto.subtle.digest("SHA-1",new TextEncoder().encode(e)),i=Array.from(new Uint8Array(t)).map(s=>s.toString(16).padStart(2,"0")).join("");return{releaseUrl:e,version:"custom-"+i.substring(0,8),source:"inferred"}}else if(e==="trunk"||e==="nightly")return{releaseUrl:"https://wordpress.org/nightly-builds/wordpress-latest.zip",version:"nightly-"+new Date().toISOString().split("T")[0],source:"inferred"};let n=await(await L("https://api.wordpress.org/core/version-check/1.7/?channel=beta")).json();n=n.offers.filter(t=>t.response==="autoupdate");for(const t of n){if(e==="beta"&&t.version.includes("beta"))return{releaseUrl:t.download,version:t.version,source:"api"};if(e==="latest"&&!t.version.includes("beta"))return{releaseUrl:t.download,version:t.version,source:"api"};if(t.version.substring(0,e.length)===e)return{releaseUrl:t.download,version:t.version,source:"api"}}return{releaseUrl:`https://wordpress.org/wordpress-${e}.zip`,version:e,source:"inferred"}}exports.bootRequestHandler=g;exports.bootWordPress=T;exports.defineWpConfigConstants=_;exports.ensureWpConfig=h;exports.getFileNotFoundActionForWordPress=$;exports.getLoadedWordPressVersion=v;exports.preloadPhpInfoRoute=P;exports.preloadSqliteIntegration=y;exports.resolveWordPressRelease=x;exports.setupPlatformLevelMuPlugins=b;exports.unzipWordPress=k;exports.versionStringToLoadedWordPressVersion=w;exports.wordPressRewriteRules=m;
696
705
  //# sourceMappingURL=index.cjs.map
package/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { phpVars as h, joinPaths as s, dirname as $, basename as g, phpVar as l } from "@php-wasm/util";
1
+ import { phpVars as h, joinPaths as s, dirname as g, basename as $, phpVar as l } from "@php-wasm/util";
2
2
  import { createMemoizedFetch as w, unzipFile as p } from "@wp-playground/common";
3
3
  import { logger as _ } from "@php-wasm/logger";
4
4
  import { sandboxedSpawnHandlerFactory as m, PHPRequestHandler as b, withPHPIniValues as y, PHP as k, setPhpIniEntries as P, writeFiles as E, proxyFileSystem as T, rotatePHPRuntime as S } from "@php-wasm/universal";
@@ -375,13 +375,13 @@ async function x(e, r) {
375
375
  )
376
376
  ), await v(e, n, t, "skip");
377
377
  }
378
- async function M(e) {
378
+ async function H(e) {
379
379
  var t, i;
380
380
  const r = await L(e), n = await r.getPrimaryPhp();
381
381
  if ((t = e.hooks) != null && t.beforeWordPressFiles && await e.hooks.beforeWordPressFiles(n), e.wordPressZip && await F(n, await e.wordPressZip), e.constants)
382
382
  for (const o in e.constants)
383
383
  n.defineConstant(o, e.constants[o]);
384
- if (e.dataSqlPath && (n.defineConstant("DB_DIR", $(e.dataSqlPath)), n.defineConstant("DB_FILE", g(e.dataSqlPath))), n.defineConstant("WP_HOME", e.siteUrl), n.defineConstant("WP_SITEURL", e.siteUrl), await x(n, r.documentRoot), (i = e.hooks) != null && i.beforeDatabaseSetup && await e.hooks.beforeDatabaseSetup(n), e.sqliteIntegrationPluginZip && await A(
384
+ if (e.dataSqlPath && (n.defineConstant("DB_DIR", g(e.dataSqlPath)), n.defineConstant("DB_FILE", $(e.dataSqlPath))), n.defineConstant("WP_HOME", e.siteUrl), n.defineConstant("WP_SITEURL", e.siteUrl), await x(n, r.documentRoot), (i = e.hooks) != null && i.beforeDatabaseSetup && await e.hooks.beforeDatabaseSetup(n), e.sqliteIntegrationPluginZip && await D(
385
385
  n,
386
386
  await e.sqliteIntegrationPluginZip
387
387
  ), !e.dataSqlPath && (await f(n) || await I(n), !await f(n)))
@@ -392,7 +392,7 @@ async function L(e) {
392
392
  const r = e.spawnHandler ?? m;
393
393
  async function n(i, o) {
394
394
  const a = new k(await e.createPhpRuntime());
395
- return e.sapiName && a.setSapiName(e.sapiName), i && (a.requestHandler = i), e.phpIniEntries && P(a, e.phpIniEntries), o ? (await C(a), await E(a, "/", e.createFiles || {}), await D(
395
+ return e.sapiName && a.setSapiName(e.sapiName), i && (a.requestHandler = i), e.phpIniEntries && P(a, e.phpIniEntries), o ? (await C(a), await E(a, "/", e.createFiles || {}), await A(
396
396
  a,
397
397
  s(new URL(e.siteUrl).pathname, "phpinfo.php")
398
398
  )) : T(await i.getPrimaryPhp(), a, [
@@ -763,7 +763,7 @@ async function C(e) {
763
763
  })();`
764
764
  );
765
765
  }
766
- async function D(e, r = "/phpinfo.php") {
766
+ async function A(e, r = "/phpinfo.php") {
767
767
  await e.writeFile(
768
768
  "/internal/shared/preload/phpinfo.php",
769
769
  `<?php
@@ -777,7 +777,7 @@ async function D(e, r = "/phpinfo.php") {
777
777
  `
778
778
  );
779
779
  }
780
- async function A(e, r) {
780
+ async function D(e, r) {
781
781
  await e.isDir("/tmp/sqlite-database-integration") && await e.rmdir("/tmp/sqlite-database-integration", {
782
782
  recursive: !0
783
783
  }), await e.mkdir("/tmp/sqlite-database-integration"), await p(e, r, "/tmp/sqlite-database-integration");
@@ -852,6 +852,15 @@ class Playground_SQLite_Integration_Loader {
852
852
  require_once ${l(u)};
853
853
  }
854
854
  }
855
+ /**
856
+ * The Query Monitor plugin short-circuits in the CLI SAPI. However, in Playground,
857
+ * the SAPI is always "cli" at the moment. Let's set a constant to disable the CLI
858
+ * detection.
859
+ *
860
+ * @see https://github.com/WordPress/sqlite-database-integration/pull/212
861
+ * @see https://github.com/WordPress/sqlite-database-integration/pull/215
862
+ */
863
+ define('QM_TESTS', true);
855
864
  $wpdb = $GLOBALS['wpdb'] = new Playground_SQLite_Integration_Loader();
856
865
 
857
866
  /**
@@ -972,13 +981,13 @@ async function Q(e = "latest") {
972
981
  }
973
982
  export {
974
983
  L as bootRequestHandler,
975
- M as bootWordPress,
984
+ H as bootWordPress,
976
985
  v as defineWpConfigConstants,
977
986
  x as ensureWpConfig,
978
987
  U as getFileNotFoundActionForWordPress,
979
988
  z as getLoadedWordPressVersion,
980
- D as preloadPhpInfoRoute,
981
- A as preloadSqliteIntegration,
989
+ A as preloadPhpInfoRoute,
990
+ D as preloadSqliteIntegration,
982
991
  Q as resolveWordPressRelease,
983
992
  C as setupPlatformLevelMuPlugins,
984
993
  F as unzipWordPress,
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":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-playground/wordpress",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "WordPress-related plumbing for WordPress Playground",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,18 +35,18 @@
35
35
  "access": "public",
36
36
  "directory": "../../../dist/packages/playground/wordpress"
37
37
  },
38
- "gitHead": "6355c320ae2de93d4a0176e45ded2ad4cc6f4ae2",
38
+ "gitHead": "9d14cae73a85996c749bdca82b8266572d4c1e31",
39
39
  "dependencies": {
40
40
  "express": "4.21.2",
41
41
  "ini": "4.1.2",
42
42
  "wasm-feature-detect": "1.8.0",
43
43
  "ws": "8.18.1",
44
44
  "yargs": "17.7.2",
45
- "@php-wasm/universal": "2.0.3",
46
- "@php-wasm/util": "2.0.3",
47
- "@php-wasm/logger": "2.0.3",
48
- "@wp-playground/common": "2.0.3",
49
- "@php-wasm/node": "2.0.3"
45
+ "@php-wasm/universal": "2.0.5",
46
+ "@php-wasm/util": "2.0.5",
47
+ "@php-wasm/logger": "2.0.5",
48
+ "@wp-playground/common": "2.0.5",
49
+ "@php-wasm/node": "2.0.5"
50
50
  },
51
51
  "overrides": {
52
52
  "rollup": "^4.34.6",