@wp-playground/wordpress 3.0.20 → 3.0.22

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
@@ -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 w(e,n){const t=a.joinPaths(n,"wp-config.php"),i={DB_NAME:"wordpress"};!e.fileExists(t)&&e.fileExists(a.joinPaths(n,"wp-config-sample.php"))&&await e.writeFile(t,await e.readFileAsBuffer(a.joinPaths(n,"wp-config-sample.php"))),await g(e,t,i,"skip")}async function L(e){const n=await m(e);return await $(n,e),n}async function $(e,n){var l,s;const t=await e.getPrimaryPhp();if((l=n.hooks)!=null&&l.beforeWordPressFiles&&await n.hooks.beforeWordPressFiles(t),n.wordPressZip&&await S(t,await n.wordPressZip),n.constants)for(const d in n.constants)t.defineConstant(d,n.constants[d]);n.dataSqlPath&&(t.defineConstant("DB_DIR",a.dirname(n.dataSqlPath)),t.defineConstant("DB_FILE",a.basename(n.dataSqlPath))),t.defineConstant("WP_HOME",n.siteUrl),t.defineConstant("WP_SITEURL",n.siteUrl),await w(t,e.documentRoot),(s=n.hooks)!=null&&s.beforeDatabaseSetup&&await n.hooks.beforeDatabaseSetup(t);let i=!1;n.sqliteIntegrationPluginZip&&(i=!0,await R(t,await n.sqliteIntegrationPluginZip));const r=n.wordpressInstallMode??"download-and-install",o=!!n.dataSqlPath;if(["download-and-install","install-from-existing-files"].includes(r)){await c(e,{usesSqlite:i,hasCustomDatabasePath:o});try{await _(t)}catch(d){throw o||await p(e),d}o||await p(e)}else if(r==="install-from-existing-files-if-needed"){if(await c(e,{usesSqlite:i,hasCustomDatabasePath:o}),!await b(t))try{await _(t)}catch(d){throw o||await p(e),d}o||await p(e)}return e}async function c(e,{usesSqlite:n,hasCustomDatabasePath:t}){const i=await e.getPrimaryPhp();if(i.isFile("/internal/shared/preload/0-sqlite.php"))return;const r=a.joinPaths(e.documentRoot,"wp-content/mu-plugins/sqlite-database-integration");if(!i.isDir(r)&&!n&&!t)throw new Error("Error connecting to the MySQL database.")}async function p(e){const n=await e.getPrimaryPhp();if(await I(n))return;if(n.isFile("/internal/shared/preload/0-sqlite.php"))throw new Error("Error connecting to the SQLite database.");const i=a.joinPaths(e.documentRoot,"wp-content/mu-plugins/sqlite-database-integration");throw n.isDir(i)?new Error("Error connecting to the SQLite database."):new Error("Error connecting to the MySQL database.")}async function m(e){const n=e.spawnHandler??u.sandboxedSpawnHandlerFactory;async function t(r,o){const l=await e.createPhpRuntime(o),s=new u.PHP(l);return e.sapiName&&s.setSapiName(e.sapiName),r&&(s.requestHandler=r),e.phpIniEntries&&u.setPhpIniEntries(s,e.phpIniEntries),s.defineConstant("WP_SQLITE_AST_DRIVER",!0),o&&!s.isFile("/internal/.boot-files-written")&&(await E(s),await u.writeFiles(s,"/",e.createFiles||{}),await T(s,a.joinPaths(new URL(e.siteUrl).pathname,"phpinfo.php")),await u.writeFiles(s,"/internal",{".boot-files-written":""})),n&&await s.setSpawnHandler(n(r.processManager)),s.enableRuntimeRotation({recreateRuntime:e.createPhpRuntime,maxRequests:400}),e.onPHPInstanceCreated&&await e.onPHPInstanceCreated(s,{isPrimary:o}),s}const i=new u.PHPRequestHandler({phpFactory:async({isPrimary:r})=>t(i,r),documentRoot:e.documentRoot||"/wordpress",absoluteUrl:e.siteUrl,rewriteRules:k,getFileNotFoundAction:e.getFileNotFoundAction??y,cookieStore:e.cookieStore});return i}async function b(e){return(await e.run({code:`<?php
355
+ `})).text!=="1")throw new Error("Failed to rewrite constants in wp-config.php.")}async function w(e,n){const t=a.joinPaths(n,"wp-config.php"),i={DB_NAME:"wordpress"};!e.fileExists(t)&&e.fileExists(a.joinPaths(n,"wp-config-sample.php"))&&await e.writeFile(t,await e.readFileAsBuffer(a.joinPaths(n,"wp-config-sample.php"))),await g(e,t,i,"skip")}async function L(e){const n=await m(e);return await $(n,e),n}async function $(e,n){var l,s;const t=await e.getPrimaryPhp();if((l=n.hooks)!=null&&l.beforeWordPressFiles&&await n.hooks.beforeWordPressFiles(t),n.wordPressZip&&await S(t,await n.wordPressZip),n.constants)for(const d in n.constants)t.defineConstant(d,n.constants[d]);n.dataSqlPath&&(t.defineConstant("DB_DIR",a.dirname(n.dataSqlPath)),t.defineConstant("DB_FILE",a.basename(n.dataSqlPath))),t.defineConstant("WP_HOME",n.siteUrl),t.defineConstant("WP_SITEURL",n.siteUrl),await w(t,e.documentRoot),(s=n.hooks)!=null&&s.beforeDatabaseSetup&&await n.hooks.beforeDatabaseSetup(t);let i=!1;n.sqliteIntegrationPluginZip&&(i=!0,await T(t,await n.sqliteIntegrationPluginZip));const r=n.wordpressInstallMode??"download-and-install",o=!!n.dataSqlPath;if(["download-and-install","install-from-existing-files"].includes(r)){await c(e,{usesSqlite:i,hasCustomDatabasePath:o});try{await _(t)}catch(d){throw o||await p(e),d}o||await p(e)}else if(r==="install-from-existing-files-if-needed"){if(await c(e,{usesSqlite:i,hasCustomDatabasePath:o}),!await b(t))try{await _(t)}catch(d){throw o||await p(e),d}o||await p(e)}return e}async function c(e,{usesSqlite:n,hasCustomDatabasePath:t}){const i=await e.getPrimaryPhp();if(i.isFile("/internal/shared/preload/0-sqlite.php"))return;const r=a.joinPaths(e.documentRoot,"wp-content/mu-plugins/sqlite-database-integration");if(!i.isDir(r)&&!n&&!t)throw new Error("Error connecting to the MySQL database.")}async function p(e){const n=await e.getPrimaryPhp();if(await I(n))return;if(n.isFile("/internal/shared/preload/0-sqlite.php"))throw new Error("Error connecting to the SQLite database.");const i=a.joinPaths(e.documentRoot,"wp-content/mu-plugins/sqlite-database-integration");throw n.isDir(i)?new Error("Error connecting to the SQLite database."):new Error("Error connecting to the MySQL database.")}async function m(e){const n=e.spawnHandler??u.sandboxedSpawnHandlerFactory;async function t(r,o){const l=await e.createPhpRuntime(o),s=new u.PHP(l);return e.sapiName&&s.setSapiName(e.sapiName),r&&(s.requestHandler=r),e.phpIniEntries&&u.setPhpIniEntries(s,e.phpIniEntries),s.defineConstant("WP_SQLITE_AST_DRIVER",!0),o&&!s.isFile("/internal/.boot-files-written")&&(await E(s),await u.writeFiles(s,"/",e.createFiles||{}),await R(s,a.joinPaths(new URL(e.siteUrl).pathname,"phpinfo.php")),await u.writeFiles(s,"/internal",{".boot-files-written":""})),n&&await s.setSpawnHandler(n(r.processManager)),s.enableRuntimeRotation({recreateRuntime:e.createPhpRuntime,maxRequests:400}),e.onPHPInstanceCreated&&await e.onPHPInstanceCreated(s,{isPrimary:o}),s}const i=new u.PHPRequestHandler({phpFactory:async({isPrimary:r})=>t(i,r),documentRoot:e.documentRoot||"/wordpress",absoluteUrl:e.siteUrl,rewriteRules:k,getFileNotFoundAction:e.getFileNotFoundAction??P,cookieStore:e.cookieStore});return i}async function b(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)) {
@@ -371,14 +371,19 @@ function skip_whitespace($tokens) {
371
371
  exit;
372
372
  }
373
373
  require $wp_load;
374
+ $nice_permalinks = '/%year%/%monthnum%/%day%/%postname%/';
374
375
  $option_result = update_option(
375
376
  'permalink_structure',
376
- '/%year%/%monthnum%/%day%/%postname%/'
377
+ $nice_permalinks
377
378
  );
378
379
  ob_clean();
379
- echo $option_result ? '1' : '0';
380
+ if ( get_option( 'permalink_structure' ) === $nice_permalinks ) {
381
+ echo '1';
382
+ } else {
383
+ echo '0';
384
+ }
380
385
  ob_end_flush();
381
- `,env:{DOCUMENT_ROOT:e.documentRoot}})).text!=="1"&&h.logger.warn("Failed to default to pretty permalinks after WP install.")}function y(e){return{type:"internal-redirect",uri:"/index.php"}}async function I(e){return(await e.run({code:`<?php
386
+ `,env:{DOCUMENT_ROOT:e.documentRoot}})).text!=="1"&&h.logger.warn("Failed to default to pretty permalinks after WP install.")}function P(e){return{type:"internal-redirect",uri:"/index.php"}}async function I(e){return(await e.run({code:`<?php
382
387
  ob_start();
383
388
  $wp_load = getenv('DOCUMENT_ROOT') . '/wp-load.php';
384
389
  if (!file_exists($wp_load)) {
@@ -392,7 +397,7 @@ function skip_whitespace($tokens) {
392
397
  `,env:{DOCUMENT_ROOT:e.documentRoot}})).text==="1"}async function W(e){const{php:n,reap:t}=await e.processManager.acquirePHPInstance({considerPrimary:!0});try{const r=(await n.run({code:`<?php
393
398
  require '${e.documentRoot}/wp-includes/version.php';
394
399
  echo $wp_version;
395
- `})).text;if(!r)throw new Error("Unable to read loaded WordPress version.");return P(r)}finally{t()}}function P(e){if(/-(alpha|beta|RC)\d*-\d+$/.test(e))return"nightly";if(/-(beta|RC)\d*$/.test(e))return"beta";const i=e.match(/^(\d+\.\d+)(?:\.\d+)?$/);return i!==null?i[1]:e}const k=[{match:new RegExp("^(/[_0-9a-zA-Z-]+)?(/wp-(content|admin|includes)/.*)"),replacement:"$2"}];async function E(e){await e.mkdir("/internal/shared/mu-plugins"),await e.writeFile("/internal/shared/preload/env.php",`<?php
400
+ `})).text;if(!r)throw new Error("Unable to read loaded WordPress version.");return y(r)}finally{t()}}function y(e){if(/-(alpha|beta|RC)\d*-\d+$/.test(e))return"nightly";if(/-(beta|RC)\d*$/.test(e))return"beta";const i=e.match(/^(\d+\.\d+)(?:\.\d+)?$/);return i!==null?i[1]:e}const k=[{match:new RegExp("^(/[_0-9a-zA-Z-]+)?(/wp-(content|admin|includes)/.*)"),replacement:"$2"}];async function E(e){await e.mkdir("/internal/shared/mu-plugins"),await e.writeFile("/internal/shared/preload/env.php",`<?php
396
401
 
397
402
  // Allow adding filters/actions prior to loading WordPress.
398
403
  // $function_to_add MUST be a string.
@@ -663,13 +668,13 @@ function skip_whitespace($tokens) {
663
668
  }
664
669
  return false;
665
670
  });
666
- })();`)}async function T(e,n="/phpinfo.php"){await e.writeFile("/internal/shared/preload/phpinfo.php",`<?php
671
+ })();`)}async function R(e,n="/phpinfo.php"){await e.writeFile("/internal/shared/preload/phpinfo.php",`<?php
667
672
  // Render PHPInfo if the requested page is /phpinfo.php
668
673
  if ( isset($_SERVER['REQUEST_URI']) && ${a.phpVar(n)} === $_SERVER['REQUEST_URI'] ) {
669
674
  phpinfo();
670
675
  exit;
671
676
  }
672
- `)}async function R(e,n){await e.isDir("/tmp/sqlite-database-integration")&&await e.rmdir("/tmp/sqlite-database-integration",{recursive:!0}),await e.mkdir("/tmp/sqlite-database-integration"),await f.unzipFile(e,n,"/tmp/sqlite-database-integration");const t="/internal/shared/sqlite-database-integration",i=`/tmp/sqlite-database-integration/${(await e.listFiles("/tmp/sqlite-database-integration"))[0]}`;await e.mv(i,t),await e.defineConstant("SQLITE_MAIN_FILE","1");const o=(await e.readFileAsText(a.joinPaths(t,"db.copy"))).replace("'{SQLITE_IMPLEMENTATION_FOLDER_PATH}'",a.phpVar(t)).replace("'{SQLITE_PLUGIN}'",a.phpVar(a.joinPaths(t,"load.php"))),l=a.joinPaths(await e.documentRoot,"wp-content/db.php"),s=`<?php
677
+ `)}async function T(e,n){await e.isDir("/tmp/sqlite-database-integration")&&await e.rmdir("/tmp/sqlite-database-integration",{recursive:!0}),await e.mkdir("/tmp/sqlite-database-integration"),await f.unzipFile(e,n,"/tmp/sqlite-database-integration");const t="/internal/shared/sqlite-database-integration",i=`/tmp/sqlite-database-integration/${(await e.listFiles("/tmp/sqlite-database-integration"))[0]}`;await e.mv(i,t),await e.defineConstant("SQLITE_MAIN_FILE","1");const o=(await e.readFileAsText(a.joinPaths(t,"db.copy"))).replace("'{SQLITE_IMPLEMENTATION_FOLDER_PATH}'",a.phpVar(t)).replace("'{SQLITE_PLUGIN}'",a.phpVar(a.joinPaths(t,"load.php"))),l=a.joinPaths(await e.documentRoot,"wp-content/db.php"),s=`<?php
673
678
  // Do not preload this if WordPress comes with a custom db.php file.
674
679
  if(file_exists(${a.phpVar(l)})) {
675
680
  return;
@@ -755,5 +760,5 @@ if(!function_exists('mysqli_connect')) {
755
760
  var_dump(isset($wpdb));
756
761
  die("SQLite integration not loaded " . get_class($wpdb));
757
762
  }
758
- `)}async function S(e,n){e.mkdir("/tmp/unzipped-wordpress"),await f.unzipFile(e,n,"/tmp/unzipped-wordpress"),e.fileExists("/tmp/unzipped-wordpress/wordpress.zip")&&await f.unzipFile(e,"/tmp/unzipped-wordpress/wordpress.zip","/tmp/unzipped-wordpress");let t=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(a.joinPaths(t,"wp-config-sample.php"))){const r=e.listFiles(t);if(r.length){const o=r[0];e.fileExists(a.joinPaths(t,o,"wp-config-sample.php"))&&(t=a.joinPaths(t,o))}}const i=(r,o,l)=>{if(l.isDir(r)&&l.isDir(o))for(const s of l.listFiles(r)){const d=a.joinPaths(r,s),v=a.joinPaths(o,s);i(d,v,l)}else{if(l.fileExists(o)){const s=r.replace(/^\/tmp\/unzipped-wordpress\//,"/");h.logger.warn(`Cannot unzip WordPress files at ${o}: ${s} already exists.`);return}l.mv(r,o)}};i(t,e.documentRoot,e),e.fileExists(t)&&e.rmdir(t,{recursive:!0}),!e.fileExists(a.joinPaths(e.documentRoot,"wp-config.php"))&&e.fileExists(a.joinPaths(e.documentRoot,"wp-config-sample.php"))&&e.writeFile(a.joinPaths(e.documentRoot,"wp-config.php"),e.readFileAsText(a.joinPaths(e.documentRoot,"/wp-config-sample.php")))}const U=f.createMemoizedFetch(fetch);async function C(e="latest"){if(e.startsWith("https://")||e.startsWith("http://")){const i=await crypto.subtle.digest("SHA-1",new TextEncoder().encode(e)),r=Array.from(new Uint8Array(i)).map(o=>o.toString(16).padStart(2,"0")).join("");return{releaseUrl:e,version:"custom-"+r.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 t=await(await U("https://api.wordpress.org/core/version-check/1.7/?channel=beta")).json();t=t.offers.filter(i=>i.response==="autoupdate");for(const i of t){if(e==="beta"&&i.version.includes("beta"))return{releaseUrl:i.download,version:i.version,source:"api"};if(e==="latest"&&!i.version.includes("beta"))return{releaseUrl:i.download,version:i.version,source:"api"};if(i.version.substring(0,e.length)===e)return{releaseUrl:i.download,version:i.version,source:"api"}}return e.match(/^\d+\.\d+\.0$/)&&(e=e.split(".").slice(0,2).join(".")),{releaseUrl:`https://wordpress.org/wordpress-${e}.zip`,version:e,source:"inferred"}}exports.bootRequestHandler=m;exports.bootWordPress=$;exports.bootWordPressAndRequestHandler=L;exports.defineWpConfigConstants=g;exports.ensureWpConfig=w;exports.getFileNotFoundActionForWordPress=y;exports.getLoadedWordPressVersion=W;exports.preloadPhpInfoRoute=T;exports.preloadSqliteIntegration=R;exports.resolveWordPressRelease=C;exports.setupPlatformLevelMuPlugins=E;exports.unzipWordPress=S;exports.versionStringToLoadedWordPressVersion=P;exports.wordPressRewriteRules=k;
763
+ `)}async function S(e,n){e.mkdir("/tmp/unzipped-wordpress"),await f.unzipFile(e,n,"/tmp/unzipped-wordpress"),e.fileExists("/tmp/unzipped-wordpress/wordpress.zip")&&await f.unzipFile(e,"/tmp/unzipped-wordpress/wordpress.zip","/tmp/unzipped-wordpress");let t=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(a.joinPaths(t,"wp-config-sample.php"))){const r=e.listFiles(t);if(r.length){const o=r[0];e.fileExists(a.joinPaths(t,o,"wp-config-sample.php"))&&(t=a.joinPaths(t,o))}}const i=(r,o,l)=>{if(l.isDir(r)&&l.isDir(o))for(const s of l.listFiles(r)){const d=a.joinPaths(r,s),v=a.joinPaths(o,s);i(d,v,l)}else{if(l.fileExists(o)){const s=r.replace(/^\/tmp\/unzipped-wordpress\//,"/");h.logger.warn(`Cannot unzip WordPress files at ${o}: ${s} already exists.`);return}l.mv(r,o)}};i(t,e.documentRoot,e),e.fileExists(t)&&e.rmdir(t,{recursive:!0}),!e.fileExists(a.joinPaths(e.documentRoot,"wp-config.php"))&&e.fileExists(a.joinPaths(e.documentRoot,"wp-config-sample.php"))&&e.writeFile(a.joinPaths(e.documentRoot,"wp-config.php"),e.readFileAsText(a.joinPaths(e.documentRoot,"/wp-config-sample.php")))}const U=f.createMemoizedFetch(fetch);async function C(e="latest"){if(e===null)e="latest";else if(e.startsWith("https://")||e.startsWith("http://")){const i=await crypto.subtle.digest("SHA-1",new TextEncoder().encode(e)),r=Array.from(new Uint8Array(i)).map(o=>o.toString(16).padStart(2,"0")).join("");return{releaseUrl:e,version:"custom-"+r.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 t=await(await U("https://api.wordpress.org/core/version-check/1.7/?channel=beta")).json();t=t.offers.filter(i=>i.response==="autoupdate");for(const i of t){if(e==="beta"&&(i.version.includes("beta")||i.version.includes("RC")))return{releaseUrl:i.download,version:i.version,source:"api"};if(e==="latest"&&!i.version.includes("beta")&&!i.version.includes("RC"))return{releaseUrl:i.download,version:i.version,source:"api"};if(i.version.substring(0,e.length)===e)return{releaseUrl:i.download,version:i.version,source:"api"}}return e.match(/^\d+\.\d+\.0$/)&&(e=e.split(".").slice(0,2).join(".")),{releaseUrl:`https://wordpress.org/wordpress-${e}.zip`,version:e,source:"inferred"}}exports.bootRequestHandler=m;exports.bootWordPress=$;exports.bootWordPressAndRequestHandler=L;exports.defineWpConfigConstants=g;exports.ensureWpConfig=w;exports.getFileNotFoundActionForWordPress=P;exports.getLoadedWordPressVersion=W;exports.preloadPhpInfoRoute=R;exports.preloadSqliteIntegration=T;exports.resolveWordPressRelease=C;exports.setupPlatformLevelMuPlugins=E;exports.unzipWordPress=S;exports.versionStringToLoadedWordPressVersion=y;exports.wordPressRewriteRules=k;
759
764
  //# 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
@@ -435,7 +435,7 @@ async function _(e, {
435
435
  }
436
436
  async function p(e) {
437
437
  const n = await e.getPrimaryPhp();
438
- if (await C(n))
438
+ if (await W(n))
439
439
  return;
440
440
  if (n.isFile("/internal/shared/preload/0-sqlite.php"))
441
441
  throw new Error("Error connecting to the SQLite database.");
@@ -476,7 +476,7 @@ async function U(e) {
476
476
  documentRoot: e.documentRoot || "/wordpress",
477
477
  absoluteUrl: e.siteUrl,
478
478
  rewriteRules: D,
479
- getFileNotFoundAction: e.getFileNotFoundAction ?? W,
479
+ getFileNotFoundAction: e.getFileNotFoundAction ?? C,
480
480
  cookieStore: e.cookieStore
481
481
  });
482
482
  return i;
@@ -541,12 +541,17 @@ async function h(e) {
541
541
  exit;
542
542
  }
543
543
  require $wp_load;
544
+ $nice_permalinks = '/%year%/%monthnum%/%day%/%postname%/';
544
545
  $option_result = update_option(
545
546
  'permalink_structure',
546
- '/%year%/%monthnum%/%day%/%postname%/'
547
+ $nice_permalinks
547
548
  );
548
549
  ob_clean();
549
- echo $option_result ? '1' : '0';
550
+ if ( get_option( 'permalink_structure' ) === $nice_permalinks ) {
551
+ echo '1';
552
+ } else {
553
+ echo '0';
554
+ }
550
555
  ob_end_flush();
551
556
  `,
552
557
  env: {
@@ -554,13 +559,13 @@ async function h(e) {
554
559
  }
555
560
  })).text !== "1" && g.warn("Failed to default to pretty permalinks after WP install.");
556
561
  }
557
- function W(e) {
562
+ function C(e) {
558
563
  return {
559
564
  type: "internal-redirect",
560
565
  uri: "/index.php"
561
566
  };
562
567
  }
563
- async function C(e) {
568
+ async function W(e) {
564
569
  return (await e.run({
565
570
  code: `<?php
566
571
  ob_start();
@@ -1075,7 +1080,9 @@ async function q(e, n) {
1075
1080
  }
1076
1081
  const G = k(fetch);
1077
1082
  async function j(e = "latest") {
1078
- if (e.startsWith("https://") || e.startsWith("http://")) {
1083
+ if (e === null)
1084
+ e = "latest";
1085
+ else if (e.startsWith("https://") || e.startsWith("http://")) {
1079
1086
  const i = await crypto.subtle.digest(
1080
1087
  "SHA-1",
1081
1088
  new TextEncoder().encode(e)
@@ -1098,13 +1105,13 @@ async function j(e = "latest") {
1098
1105
  (i) => i.response === "autoupdate"
1099
1106
  );
1100
1107
  for (const i of t) {
1101
- if (e === "beta" && i.version.includes("beta"))
1108
+ if (e === "beta" && (i.version.includes("beta") || i.version.includes("RC")))
1102
1109
  return {
1103
1110
  releaseUrl: i.download,
1104
1111
  version: i.version,
1105
1112
  source: "api"
1106
1113
  };
1107
- if (e === "latest" && !i.version.includes("beta"))
1114
+ if (e === "latest" && !i.version.includes("beta") && !i.version.includes("RC"))
1108
1115
  return {
1109
1116
  releaseUrl: i.download,
1110
1117
  version: i.version,
@@ -1129,7 +1136,7 @@ export {
1129
1136
  Q as bootWordPressAndRequestHandler,
1130
1137
  x as defineWpConfigConstants,
1131
1138
  L as ensureWpConfig,
1132
- W as getFileNotFoundActionForWordPress,
1139
+ C as getFileNotFoundActionForWordPress,
1133
1140
  V as getLoadedWordPressVersion,
1134
1141
  F as preloadPhpInfoRoute,
1135
1142
  N as preloadSqliteIntegration,
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-playground/wordpress",
3
- "version": "3.0.20",
3
+ "version": "3.0.22",
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": "8fb1044d507cb9fc8d53a24b60d8d37a277c2a9f",
38
+ "gitHead": "a624d1a97dc639e152d335e6a801b2fad7f6b594",
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.3",
44
44
  "yargs": "17.7.2",
45
- "@php-wasm/universal": "3.0.20",
46
- "@php-wasm/util": "3.0.20",
47
- "@php-wasm/logger": "3.0.20",
48
- "@wp-playground/common": "3.0.20",
49
- "@php-wasm/node": "3.0.20"
45
+ "@php-wasm/universal": "3.0.22",
46
+ "@php-wasm/util": "3.0.22",
47
+ "@php-wasm/logger": "3.0.22",
48
+ "@wp-playground/common": "3.0.22",
49
+ "@php-wasm/node": "3.0.22"
50
50
  },
51
51
  "packageManager": "npm@10.9.2",
52
52
  "overrides": {