@wp-playground/wordpress 3.1.4 → 3.1.8

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
@@ -483,7 +483,7 @@ class WP_Config_Transformer {
483
483
  $transformer = WP_Config_Transformer::from_file($wp_config_path);
484
484
  $transformer->define_constants(${i.constants});
485
485
  $transformer->to_file($wp_config_path);
486
- `})).errors.length>0)throw new Error("Failed to rewrite constants in wp-config.php.")}async function x(t){const e=await w(t);return await m(e,t),e}async function m(t,e){var c,o;const n=await t.getPrimaryPhp();if((c=e.hooks)!=null&&c.beforeWordPressFiles&&await e.hooks.beforeWordPressFiles(n),e.wordPressZip&&await R(n,await e.wordPressZip),e.constants)for(const l in e.constants)n.defineConstant(l,e.constants[l]);e.dataSqlPath&&(n.defineConstant("DB_DIR",r.dirname(e.dataSqlPath)),n.defineConstant("DB_FILE",r.basename(e.dataSqlPath))),n.defineConstant("WP_HOME",e.siteUrl),n.defineConstant("WP_SITEURL",e.siteUrl),await g(n,t.documentRoot),(o=e.hooks)!=null&&o.beforeDatabaseSetup&&await e.hooks.beforeDatabaseSetup(n);let i=!1;e.sqliteIntegrationPluginZip&&(i=!0,await E(n,await e.sqliteIntegrationPluginZip));const a=e.wordpressInstallMode??"download-and-install",s=!!e.dataSqlPath;if(["download-and-install","install-from-existing-files"].includes(a)){await h(t,{usesSqlite:i,hasCustomDatabasePath:s});try{await f(n)}catch(l){throw s||await u(t),l}s||await u(t)}else if(a==="install-from-existing-files-if-needed"){if(await h(t,{usesSqlite:i,hasCustomDatabasePath:s}),!await k(n))try{await f(n)}catch(l){throw s||await u(t),l}s||await u(t)}return t}async function h(t,{usesSqlite:e,hasCustomDatabasePath:n}){const i=await t.getPrimaryPhp();if(i.isFile("/internal/shared/preload/0-sqlite.php"))return;const a=r.joinPaths(t.documentRoot,"wp-content/mu-plugins/sqlite-database-integration");if(!i.isDir(a)&&!e&&!n)throw new Error("Error connecting to the MySQL database.")}async function u(t){const e=await t.getPrimaryPhp();if(await C(e))return;if(e.isFile("/internal/shared/preload/0-sqlite.php"))throw new Error("Error connecting to the SQLite database.");const i=r.joinPaths(t.documentRoot,"wp-content/mu-plugins/sqlite-database-integration");throw e.isDir(i)?new Error("Error connecting to the SQLite database."):new Error("Error connecting to the MySQL database.")}async function w(t){const e=t.spawnHandler??d.sandboxedSpawnHandlerFactory;async function n(a,s=!1){const c=await t.createPhpRuntime(s),o=new d.PHP(c);if(t.sapiName&&o.setSapiName(t.sapiName),a&&(o.requestHandler=a),t.phpIniEntries&&d.setPhpIniEntries(o,t.phpIniEntries),o.defineConstant("WP_SQLITE_AST_DRIVER",!0),t.constants)for(const l in t.constants)o.defineConstant(l,t.constants[l]);return s&&!o.isFile("/internal/.boot-files-written")&&(await T(o),await d.writeFiles(o,"/",t.createFiles||{}),await v(o,r.joinPaths(new URL(t.siteUrl).pathname,"phpinfo.php")),await d.writeFiles(o,"/internal",{".boot-files-written":""})),e&&await o.setSpawnHandler(e(a?()=>a.instanceManager.acquirePHPInstance():void 0)),o.enableRuntimeRotation({recreateRuntime:t.createPhpRuntime,maxRequests:400}),t.onPHPInstanceCreated&&await t.onPHPInstanceCreated(o,{isPrimary:s}),o}const i=new d.PHPRequestHandler({documentRoot:t.documentRoot||"/wordpress",absoluteUrl:t.siteUrl,rewriteRules:b,pathAliases:t.pathAliases,getFileNotFoundAction:t.getFileNotFoundAction??P,cookieStore:t.cookieStore,php:t.maxPhpInstances===1?await n(void 0,!0):void 0,phpFactory:t.maxPhpInstances!==1?async({isPrimary:a})=>n(i,a):void 0,maxPhpInstances:t.maxPhpInstances});return i}async function k(t){return(await t.run({code:`<?php
486
+ `})).errors.length>0)throw new Error("Failed to rewrite constants in wp-config.php.")}async function x(t){const e=await w(t);return await m(e,t),e}async function m(t,e){var c,o;const n=await t.getPrimaryPhp();if((c=e.hooks)!=null&&c.beforeWordPressFiles&&await e.hooks.beforeWordPressFiles(n),e.wordPressZip&&await R(n,await e.wordPressZip),e.constants)for(const l in e.constants)n.defineConstant(l,e.constants[l]);e.dataSqlPath&&(n.defineConstant("DB_DIR",r.dirname(e.dataSqlPath)),n.defineConstant("DB_FILE",r.basename(e.dataSqlPath))),n.defineConstant("WP_HOME",e.siteUrl),n.defineConstant("WP_SITEURL",e.siteUrl),await g(n,t.documentRoot),(o=e.hooks)!=null&&o.beforeDatabaseSetup&&await e.hooks.beforeDatabaseSetup(n);let i=!1;e.sqliteIntegrationPluginZip&&(i=!0,await v(n,await e.sqliteIntegrationPluginZip));const a=e.wordpressInstallMode??"download-and-install",s=!!e.dataSqlPath;if(["download-and-install","install-from-existing-files"].includes(a)){await h(t,{usesSqlite:i,hasCustomDatabasePath:s});try{await f(n)}catch(l){throw s||await u(t),l}s||await u(t)}else if(a==="install-from-existing-files-if-needed"){if(await h(t,{usesSqlite:i,hasCustomDatabasePath:s}),!await P(n))try{await f(n)}catch(l){throw s||await u(t),l}s||await u(t)}return t}async function h(t,{usesSqlite:e,hasCustomDatabasePath:n}){const i=await t.getPrimaryPhp();if(i.isFile("/internal/shared/preload/0-sqlite.php"))return;const a=r.joinPaths(t.documentRoot,"wp-content/mu-plugins/sqlite-database-integration");if(!i.isDir(a)&&!e&&!n)throw new Error("Error connecting to the MySQL database.")}async function u(t){const e=await t.getPrimaryPhp();if(await C(e))return;if(e.isFile("/internal/shared/preload/0-sqlite.php"))throw new Error("Error connecting to the SQLite database.");const i=r.joinPaths(t.documentRoot,"wp-content/mu-plugins/sqlite-database-integration");throw e.isDir(i)?new Error("Error connecting to the SQLite database."):new Error("Error connecting to the MySQL database.")}async function w(t){const e=t.spawnHandler??d.sandboxedSpawnHandlerFactory;async function n(a,s=!1){const c=await t.createPhpRuntime(s),o=new d.PHP(c);if(t.sapiName&&o.setSapiName(t.sapiName),a&&(o.requestHandler=a),t.phpIniEntries&&d.setPhpIniEntries(o,t.phpIniEntries),o.defineConstant("WP_SQLITE_AST_DRIVER",!0),t.constants)for(const l in t.constants)o.defineConstant(l,t.constants[l]);return s&&!o.isFile("/internal/.boot-files-written")&&(await T(o),await d.writeFiles(o,"/",t.createFiles||{}),await E(o,r.joinPaths(new URL(t.siteUrl).pathname,"phpinfo.php")),await d.writeFiles(o,"/internal",{".boot-files-written":""})),e&&await o.setSpawnHandler(e(a?()=>a.instanceManager.acquirePHPInstance():void 0)),o.enableRuntimeRotation({recreateRuntime:t.createPhpRuntime,maxRequests:400}),t.onPHPInstanceCreated&&await t.onPHPInstanceCreated(o,{isPrimary:s}),o}const i=new d.PHPRequestHandler({documentRoot:t.documentRoot||"/wordpress",absoluteUrl:t.siteUrl,rewriteRules:b,pathAliases:t.pathAliases,getFileNotFoundAction:t.getFileNotFoundAction??k,cookieStore:t.cookieStore,php:t.maxPhpInstances===1?await n(void 0,!0):void 0,phpFactory:t.maxPhpInstances!==1?async({isPrimary:a})=>n(i,a):void 0,maxPhpInstances:t.maxPhpInstances});return i}async function P(t){return(await t.run({code:`<?php
487
487
  ob_start();
488
488
  $wp_load = getenv('DOCUMENT_ROOT') . '/wp-load.php';
489
489
  if (!file_exists($wp_load)) {
@@ -494,7 +494,7 @@ class WP_Config_Transformer {
494
494
  ob_clean();
495
495
  echo is_blog_installed() ? '1' : '0';
496
496
  ob_end_flush();
497
- `,env:{DOCUMENT_ROOT:t.documentRoot}})).text==="1"}async function f(t){var i;const e=await d.withPHPIniValues(t,{disable_functions:"fsockopen",allow_url_fopen:"0"},async()=>await t.request({url:"/wp-admin/install.php?step=2",method:"POST",body:{language:"en",prefix:"wp_",weblog_title:"My WordPress Website",user_name:"admin",admin_password:"password",admin_password2:"password",Submit:"Install WordPress",pw_weak:"1",admin_email:"admin@localhost.com"}}));if(!await k(t))throw new Error(`Failed to install WordPress – installer responded with "${(i=e.text)==null?void 0:i.substring(0,100)}"`);(await t.run({code:`<?php
497
+ `,env:{DOCUMENT_ROOT:t.documentRoot}})).text==="1"}async function f(t){var i;const e=await d.withPHPIniValues(t,{disable_functions:"fsockopen",allow_url_fopen:"0"},async()=>await t.request({url:"/wp-admin/install.php?step=2",method:"POST",body:{language:"en",prefix:"wp_",weblog_title:"My WordPress Website",user_name:"admin",admin_password:"password",admin_password2:"password",Submit:"Install WordPress",pw_weak:"1",admin_email:"admin@localhost.com"}}));if(!await P(t))throw new Error(`Failed to install WordPress – installer responded with "${(i=e.text)==null?void 0:i.substring(0,100)}"`);(await t.run({code:`<?php
498
498
  ob_start();
499
499
  $wp_load = getenv('DOCUMENT_ROOT') . '/wp-load.php';
500
500
  if (!file_exists($wp_load)) {
@@ -514,7 +514,7 @@ class WP_Config_Transformer {
514
514
  echo '0';
515
515
  }
516
516
  ob_end_flush();
517
- `,env:{DOCUMENT_ROOT:t.documentRoot}})).text!=="1"&&_.logger.warn("Failed to default to pretty permalinks after WP install.")}function P(t){return{type:"internal-redirect",uri:"/index.php"}}async function C(t){return(await t.run({code:`<?php
517
+ `,env:{DOCUMENT_ROOT:t.documentRoot}})).text!=="1"&&_.logger.warn("Failed to default to pretty permalinks after WP install.")}function k(t){return{type:"internal-redirect",uri:"/index.php"}}async function C(t){return(await t.run({code:`<?php
518
518
  ob_start();
519
519
  $wp_load = getenv('DOCUMENT_ROOT') . '/wp-load.php';
520
520
  if (!file_exists($wp_load)) {
@@ -749,8 +749,15 @@ class WP_Config_Transformer {
749
749
  }
750
750
 
751
751
  $log_file = WP_CONTENT_DIR . '/debug.log';
752
+ if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
753
+ if ( is_string( WP_DEBUG_LOG ) ) {
754
+ $log_file = WP_DEBUG_LOG;
755
+ }
756
+ ini_set('error_log', $log_file);
757
+ } else {
758
+ ini_set('log_errors', '0');
759
+ }
752
760
  define('ERROR_LOG_FILE', $log_file);
753
- ini_set('error_log', $log_file);
754
761
  ?>`),await t.writeFile("/internal/shared/mu-plugins/sitemap-redirect.php",`<?php
755
762
  /**
756
763
  * Redirect sitemap.xml to wp-sitemap.xml for non-root installations.
@@ -823,13 +830,13 @@ class WP_Config_Transformer {
823
830
  }
824
831
  return false;
825
832
  });
826
- })();`)}async function v(t,e="/phpinfo.php"){await t.writeFile("/internal/shared/preload/phpinfo.php",`<?php
833
+ })();`)}async function E(t,e="/phpinfo.php"){await t.writeFile("/internal/shared/preload/phpinfo.php",`<?php
827
834
  // Render PHPInfo if the requested page is /phpinfo.php
828
835
  if ( isset($_SERVER['REQUEST_URI']) && ${r.phpVar(e)} === $_SERVER['REQUEST_URI'] ) {
829
836
  phpinfo();
830
837
  exit;
831
838
  }
832
- `)}async function E(t,e){await t.isDir("/tmp/sqlite-database-integration")&&await t.rmdir("/tmp/sqlite-database-integration",{recursive:!0}),await t.mkdir("/tmp/sqlite-database-integration"),await p.unzipFile(t,e,"/tmp/sqlite-database-integration");const n="/internal/shared/sqlite-database-integration",i=`/tmp/sqlite-database-integration/${(await t.listFiles("/tmp/sqlite-database-integration"))[0]}`;await t.mv(i,n),await t.defineConstant("SQLITE_MAIN_FILE","1");const s=(await t.readFileAsText(r.joinPaths(n,"db.copy"))).replace("'{SQLITE_IMPLEMENTATION_FOLDER_PATH}'",r.phpVar(n)).replace("'{SQLITE_PLUGIN}'",r.phpVar(r.joinPaths(n,"load.php"))),c=r.joinPaths(await t.documentRoot,"wp-content/db.php"),o=`<?php
839
+ `)}async function v(t,e){await t.isDir("/tmp/sqlite-database-integration")&&await t.rmdir("/tmp/sqlite-database-integration",{recursive:!0}),await t.mkdir("/tmp/sqlite-database-integration"),await p.unzipFile(t,e,"/tmp/sqlite-database-integration");const n="/internal/shared/sqlite-database-integration",i=`/tmp/sqlite-database-integration/${(await t.listFiles("/tmp/sqlite-database-integration"))[0]}`;await t.mv(i,n),await t.defineConstant("SQLITE_MAIN_FILE","1");const s=(await t.readFileAsText(r.joinPaths(n,"db.copy"))).replace("'{SQLITE_IMPLEMENTATION_FOLDER_PATH}'",r.phpVar(n)).replace("'{SQLITE_PLUGIN}'",r.phpVar(r.joinPaths(n,"load.php"))),c=r.joinPaths(await t.documentRoot,"wp-content/db.php"),o=`<?php
833
840
  // Do not preload this if WordPress comes with a custom db.php file.
834
841
  if(file_exists(${r.phpVar(c)})) {
835
842
  return;
@@ -915,5 +922,5 @@ if(!function_exists('mysqli_connect')) {
915
922
  var_dump(isset($wpdb));
916
923
  die("SQLite integration not loaded " . get_class($wpdb));
917
924
  }
918
- `)}async function R(t,e){t.mkdir("/tmp/unzipped-wordpress"),await p.unzipFile(t,e,"/tmp/unzipped-wordpress"),t.fileExists("/tmp/unzipped-wordpress/wordpress.zip")&&await p.unzipFile(t,"/tmp/unzipped-wordpress/wordpress.zip","/tmp/unzipped-wordpress");let n=t.fileExists("/tmp/unzipped-wordpress/wordpress")?"/tmp/unzipped-wordpress/wordpress":t.fileExists("/tmp/unzipped-wordpress/build")?"/tmp/unzipped-wordpress/build":"/tmp/unzipped-wordpress";if(!t.fileExists(r.joinPaths(n,"wp-config-sample.php"))){const a=t.listFiles(n);if(a.length){const s=a[0];t.fileExists(r.joinPaths(n,s,"wp-config-sample.php"))&&(n=r.joinPaths(n,s))}}const i=(a,s,c)=>{if(c.isDir(a)&&c.isDir(s))for(const o of c.listFiles(a)){const l=r.joinPaths(a,o),S=r.joinPaths(s,o);i(l,S,c)}else{if(c.fileExists(s)){const o=a.replace(/^\/tmp\/unzipped-wordpress\//,"/");_.logger.warn(`Cannot unzip WordPress files at ${s}: ${o} already exists.`);return}c.mv(a,s)}};i(n,t.documentRoot,t),t.fileExists(n)&&t.rmdir(n,{recursive:!0}),!t.fileExists(r.joinPaths(t.documentRoot,"wp-config.php"))&&t.fileExists(r.joinPaths(t.documentRoot,"wp-config-sample.php"))&&t.writeFile(r.joinPaths(t.documentRoot,"wp-config.php"),t.readFileAsText(r.joinPaths(t.documentRoot,"/wp-config-sample.php")))}const W=p.createMemoizedFetch(fetch),q="https://github.com/WordPress/WordPress/archive/refs/heads/master.zip";async function A(t="latest"){if(t===null)t="latest";else if(t.startsWith("https://")||t.startsWith("http://")){const i=await crypto.subtle.digest("SHA-1",new TextEncoder().encode(t)),a=Array.from(new Uint8Array(i)).map(s=>s.toString(16).padStart(2,"0")).join("");return{releaseUrl:t,version:"custom-"+a.substring(0,8),source:"inferred"}}else if(t==="trunk"||t==="nightly"){const i=new Date().toISOString().split("T")[0];return{releaseUrl:`${q}?ts=${i}`,version:"trunk",source:"inferred"}}let n=await(await W("https://api.wordpress.org/core/version-check/1.7/?channel=beta")).json();n=n.offers.filter(i=>i.response==="autoupdate");for(const i of n){if(t==="beta"&&(i.version.includes("beta")||i.version.includes("RC")))return{releaseUrl:i.download,version:i.version,source:"api"};if(t==="latest"&&!i.version.includes("beta")&&!i.version.includes("RC"))return{releaseUrl:i.download,version:i.version,source:"api"};if(i.version.substring(0,t.length)===t)return{releaseUrl:i.download,version:i.version,source:"api"}}return t.match(/^\d+\.\d+\.0$/)&&(t=t.split(".").slice(0,2).join(".")),{releaseUrl:`https://wordpress.org/wordpress-${t}.zip`,version:t,source:"inferred"}}exports.bootRequestHandler=w;exports.bootWordPress=m;exports.bootWordPressAndRequestHandler=x;exports.defineWpConfigConstants=I;exports.ensureWpConfig=g;exports.getFileNotFoundActionForWordPress=P;exports.getLoadedWordPressVersion=L;exports.preloadPhpInfoRoute=v;exports.preloadSqliteIntegration=E;exports.resolveWordPressRelease=A;exports.setupPlatformLevelMuPlugins=T;exports.unzipWordPress=R;exports.versionStringToLoadedWordPressVersion=y;exports.wordPressRewriteRules=b;
925
+ `)}async function R(t,e){t.mkdir("/tmp/unzipped-wordpress"),await p.unzipFile(t,e,"/tmp/unzipped-wordpress"),t.fileExists("/tmp/unzipped-wordpress/wordpress.zip")&&await p.unzipFile(t,"/tmp/unzipped-wordpress/wordpress.zip","/tmp/unzipped-wordpress");let n=t.fileExists("/tmp/unzipped-wordpress/wordpress")?"/tmp/unzipped-wordpress/wordpress":t.fileExists("/tmp/unzipped-wordpress/build")?"/tmp/unzipped-wordpress/build":"/tmp/unzipped-wordpress";if(!t.fileExists(r.joinPaths(n,"wp-config-sample.php"))){const a=t.listFiles(n);if(a.length){const s=a[0];t.fileExists(r.joinPaths(n,s,"wp-config-sample.php"))&&(n=r.joinPaths(n,s))}}const i=(a,s,c)=>{if(c.isDir(a)&&c.isDir(s))for(const o of c.listFiles(a)){const l=r.joinPaths(a,o),S=r.joinPaths(s,o);i(l,S,c)}else{if(c.fileExists(s)){const o=a.replace(/^\/tmp\/unzipped-wordpress\//,"/");_.logger.warn(`Cannot unzip WordPress files at ${s}: ${o} already exists.`);return}c.mv(a,s)}};i(n,t.documentRoot,t),t.fileExists(n)&&t.rmdir(n,{recursive:!0}),!t.fileExists(r.joinPaths(t.documentRoot,"wp-config.php"))&&t.fileExists(r.joinPaths(t.documentRoot,"wp-config-sample.php"))&&t.writeFile(r.joinPaths(t.documentRoot,"wp-config.php"),t.readFileAsText(r.joinPaths(t.documentRoot,"/wp-config-sample.php")))}const W=p.createMemoizedFetch(fetch),O="https://github.com/WordPress/WordPress/archive/refs/heads/master.zip";async function q(t="latest"){if(t===null)t="latest";else if(t.startsWith("https://")||t.startsWith("http://")){const i=await crypto.subtle.digest("SHA-1",new TextEncoder().encode(t)),a=Array.from(new Uint8Array(i)).map(s=>s.toString(16).padStart(2,"0")).join("");return{releaseUrl:t,version:"custom-"+a.substring(0,8),source:"inferred"}}else if(t==="trunk"||t==="nightly"){const i=new Date().toISOString().split("T")[0];return{releaseUrl:`${O}?ts=${i}`,version:"trunk",source:"inferred"}}let n=await(await W("https://api.wordpress.org/core/version-check/1.7/?channel=beta")).json();n=n.offers.filter(i=>i.response==="autoupdate");for(const i of n){if(t==="beta"&&(i.version.includes("beta")||i.version.includes("RC")))return{releaseUrl:i.download,version:i.version,source:"api"};if(t==="latest"&&!i.version.includes("beta")&&!i.version.includes("RC"))return{releaseUrl:i.download,version:i.version,source:"api"};if(i.version.substring(0,t.length)===t)return{releaseUrl:i.download,version:i.version,source:"api"}}return t.match(/^\d+\.\d+\.0$/)&&(t=t.split(".").slice(0,2).join(".")),{releaseUrl:`https://wordpress.org/wordpress-${t}.zip`,version:t,source:"inferred"}}exports.bootRequestHandler=w;exports.bootWordPress=m;exports.bootWordPressAndRequestHandler=x;exports.defineWpConfigConstants=I;exports.ensureWpConfig=g;exports.getFileNotFoundActionForWordPress=k;exports.getLoadedWordPressVersion=L;exports.preloadPhpInfoRoute=E;exports.preloadSqliteIntegration=v;exports.resolveWordPressRelease=q;exports.setupPlatformLevelMuPlugins=T;exports.unzipWordPress=R;exports.versionStringToLoadedWordPressVersion=y;exports.wordPressRewriteRules=b;
919
926
  //# sourceMappingURL=index.cjs.map
package/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/index.js CHANGED
@@ -500,7 +500,7 @@ async function I(t, e) {
500
500
  })).errors.length > 0)
501
501
  throw new Error("Failed to auto-configure wp-config.php.");
502
502
  }
503
- async function B(t, e, n) {
503
+ async function j(t, e, n) {
504
504
  const i = $({ wpConfigPath: e, constants: n });
505
505
  if ((await t.run({
506
506
  code: `${m}
@@ -599,7 +599,7 @@ async function C(t) {
599
599
  * mechanism. It works, because secondary workers are only booted
600
600
  * once the primary worker has fully booted.
601
601
  */
602
- !r.isFile("/internal/.boot-files-written") && (await U(r), await f(r, "/", t.createFiles || {}), await W(
602
+ !r.isFile("/internal/.boot-files-written") && (await A(r), await f(r, "/", t.createFiles || {}), await q(
603
603
  r,
604
604
  s(new URL(t.siteUrl).pathname, "phpinfo.php")
605
605
  ), await f(r, "/internal", {
@@ -616,7 +616,7 @@ async function C(t) {
616
616
  const i = new E({
617
617
  documentRoot: t.documentRoot || "/wordpress",
618
618
  absoluteUrl: t.siteUrl,
619
- rewriteRules: q,
619
+ rewriteRules: W,
620
620
  pathAliases: t.pathAliases,
621
621
  getFileNotFoundAction: t.getFileNotFoundAction ?? L,
622
622
  cookieStore: t.cookieStore,
@@ -750,12 +750,12 @@ async function V(t) {
750
750
  })).text;
751
751
  if (!a)
752
752
  throw new Error("Unable to read loaded WordPress version.");
753
- return A(a);
753
+ return U(a);
754
754
  } finally {
755
755
  n();
756
756
  }
757
757
  }
758
- function A(t) {
758
+ function U(t) {
759
759
  if (/-(alpha|beta|RC)\d*-\d+$/.test(t))
760
760
  return "trunk";
761
761
  if (/-(beta|RC)\d*$/.test(t))
@@ -763,7 +763,7 @@ function A(t) {
763
763
  const i = t.match(/^(\d+\.\d+)(?:\.\d+)?$/);
764
764
  return i !== null ? i[1] : t;
765
765
  }
766
- const q = [
766
+ const W = [
767
767
  /**
768
768
  * Substitutes the multisite WordPress rewrite rule:
769
769
  *
@@ -779,7 +779,7 @@ const q = [
779
779
  replacement: "$2"
780
780
  }
781
781
  ];
782
- async function U(t) {
782
+ async function A(t) {
783
783
  await t.mkdir("/internal/shared/mu-plugins"), await t.writeFile(
784
784
  "/internal/shared/preload/env.php",
785
785
  `<?php
@@ -1009,8 +1009,15 @@ async function U(t) {
1009
1009
  }
1010
1010
 
1011
1011
  $log_file = WP_CONTENT_DIR . '/debug.log';
1012
+ if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
1013
+ if ( is_string( WP_DEBUG_LOG ) ) {
1014
+ $log_file = WP_DEBUG_LOG;
1015
+ }
1016
+ ini_set('error_log', $log_file);
1017
+ } else {
1018
+ ini_set('log_errors', '0');
1019
+ }
1012
1020
  define('ERROR_LOG_FILE', $log_file);
1013
- ini_set('error_log', $log_file);
1014
1021
  ?>`
1015
1022
  ), await t.writeFile(
1016
1023
  "/internal/shared/mu-plugins/sitemap-redirect.php",
@@ -1092,7 +1099,7 @@ async function U(t) {
1092
1099
  })();`
1093
1100
  );
1094
1101
  }
1095
- async function W(t, e = "/phpinfo.php") {
1102
+ async function q(t, e = "/phpinfo.php") {
1096
1103
  await t.writeFile(
1097
1104
  "/internal/shared/preload/phpinfo.php",
1098
1105
  `<?php
@@ -1316,16 +1323,16 @@ export {
1316
1323
  C as bootRequestHandler,
1317
1324
  x as bootWordPress,
1318
1325
  Q as bootWordPressAndRequestHandler,
1319
- B as defineWpConfigConstants,
1326
+ j as defineWpConfigConstants,
1320
1327
  I as ensureWpConfig,
1321
1328
  L as getFileNotFoundActionForWordPress,
1322
1329
  V as getLoadedWordPressVersion,
1323
- W as preloadPhpInfoRoute,
1330
+ q as preloadPhpInfoRoute,
1324
1331
  F as preloadSqliteIntegration,
1325
1332
  Z as resolveWordPressRelease,
1326
- U as setupPlatformLevelMuPlugins,
1333
+ A as setupPlatformLevelMuPlugins,
1327
1334
  N as unzipWordPress,
1328
- A as versionStringToLoadedWordPressVersion,
1329
- q as wordPressRewriteRules
1335
+ U as versionStringToLoadedWordPressVersion,
1336
+ W as wordPressRewriteRules
1330
1337
  };
1331
1338
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ing for WordPress Playground",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,21 +35,21 @@
35
35
  "access": "public",
36
36
  "directory": "../../../dist/packages/playground/wordpress"
37
37
  },
38
- "gitHead": "a7cde6f2a2d3cef27f51f24e9ddadbe5ca05344b",
38
+ "gitHead": "ba6a9509c9db4e0b7af6f155cf31162a6b659b5f",
39
39
  "dependencies": {
40
40
  "express": "4.22.0",
41
- "fast-xml-parser": "^5.3.4",
41
+ "fast-xml-parser": "^5.5.1",
42
42
  "fs-ext-extra-prebuilt": "2.2.7",
43
43
  "ini": "4.1.2",
44
44
  "jsonc-parser": "3.3.1",
45
45
  "wasm-feature-detect": "1.8.0",
46
46
  "ws": "8.18.3",
47
47
  "yargs": "17.7.2",
48
- "@php-wasm/universal": "3.1.4",
49
- "@php-wasm/util": "3.1.4",
50
- "@php-wasm/logger": "3.1.4",
51
- "@wp-playground/common": "3.1.4",
52
- "@php-wasm/node": "3.1.4"
48
+ "@php-wasm/universal": "3.1.8",
49
+ "@php-wasm/util": "3.1.8",
50
+ "@php-wasm/logger": "3.1.8",
51
+ "@wp-playground/common": "3.1.8",
52
+ "@php-wasm/node": "3.1.8"
53
53
  },
54
54
  "packageManager": "npm@10.9.2",
55
55
  "overrides": {
@@ -58,7 +58,6 @@
58
58
  "react-dom": "18.3.1",
59
59
  "typescript": "5.4.5",
60
60
  "@playwright/test": "1.55.1",
61
- "ws": "8.18.3",
62
61
  "tmp": "0.2.5",
63
62
  "form-data": "^4.0.4",
64
63
  "lodash": "^4.17.23",