@wp-playground/client 0.1.45 → 0.1.49

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.d.ts CHANGED
@@ -259,7 +259,33 @@ export interface RequestHandler {
259
259
  /**
260
260
  * Serves the request – either by serving a static file, or by
261
261
  * dispatching it to the PHP runtime.
262
- * Cannot be used in conjunction with `cli()`.
262
+ *
263
+ * The request() method mode behaves like a web server and only works if
264
+ * the PHP was initialized with a `requestHandler` option (which the online version
265
+ * of WordPress Playground does by default).
266
+ *
267
+ * In the request mode, you pass an object containing the request information
268
+ * (method, headers, body, etc.) and the path to the PHP file to run:
269
+ *
270
+ * ```ts
271
+ * const php = PHP.load('7.4', {
272
+ * requestHandler: {
273
+ * documentRoot: "/www"
274
+ * }
275
+ * })
276
+ * php.writeFile("/www/index.php", `<?php echo file_get_contents("php://input");`);
277
+ * const result = await php.run({
278
+ * method: "GET",
279
+ * headers: {
280
+ * "Content-Type": "text/plain"
281
+ * },
282
+ * body: "Hello world!",
283
+ * path: "/www/index.php"
284
+ * });
285
+ * // result.text === "Hello world!"
286
+ * ```
287
+ *
288
+ * The `request()` method cannot be used in conjunction with `cli()`.
263
289
  *
264
290
  * @example
265
291
  * ```js
@@ -306,7 +332,18 @@ export interface RequestHandler {
306
332
  documentRoot: string;
307
333
  }
308
334
  export interface IsomorphicLocalPHP extends RequestHandler {
335
+ /**
336
+ * Sets the path to the php.ini file to use for the PHP instance.
337
+ *
338
+ * @param path - The path to the php.ini file.
339
+ */
309
340
  setPhpIniPath(path: string): void;
341
+ /**
342
+ * Sets a value for a specific key in the php.ini file for the PHP instance.
343
+ *
344
+ * @param key - The key to set the value for.
345
+ * @param value - The value to set for the key.
346
+ */
310
347
  setPhpIniEntry(key: string, value: string): void;
311
348
  /**
312
349
  * Recursively creates a directory with the given path in the PHP filesystem.
@@ -398,24 +435,72 @@ export interface IsomorphicLocalPHP extends RequestHandler {
398
435
  chdir(path: string): void;
399
436
  /**
400
437
  * Runs PHP code.
401
- * Cannot be used in conjunction with `cli()`.
402
438
  *
403
- * @example
404
- * ```js
405
- * const output = await php.run('<?php echo "Hello world!";');
406
- * console.log(output.stdout); // "Hello world!"
439
+ * This low-level method directly interacts with the WebAssembly
440
+ * PHP interpreter.
441
+ *
442
+ * Every time you call run(), it prepares the PHP
443
+ * environment and:
444
+ *
445
+ * * Resets the internal PHP state
446
+ * * Populates superglobals ($_SERVER, $_GET, etc.)
447
+ * * Handles file uploads
448
+ * * Populates input streams (stdin, argv, etc.)
449
+ * * Sets the current working directory
450
+ *
451
+ * You can use run() in two primary modes:
452
+ *
453
+ * ### Code snippet mode
454
+ *
455
+ * In this mode, you pass a string containing PHP code to run.
456
+ *
457
+ * ```ts
458
+ * const result = await php.run({
459
+ * code: `<?php echo "Hello world!";`
460
+ * });
461
+ * // result.text === "Hello world!"
407
462
  * ```
408
463
  *
464
+ * In this mode, information like __DIR__ or __FILE__ isn't very
465
+ * useful because the code is not associated with any file.
466
+ *
467
+ * Under the hood, the PHP snippet is passed to the `zend_eval_string`
468
+ * C function.
469
+ *
470
+ * ### File mode
471
+ *
472
+ * In the file mode, you pass a scriptPath and PHP executes a file
473
+ * found at a that path:
474
+ *
475
+ * ```ts
476
+ * php.writeFile(
477
+ * "/www/index.php",
478
+ * `<?php echo "Hello world!";"`
479
+ * );
480
+ * const result = await php.run({
481
+ * scriptPath: "/www/index.php"
482
+ * });
483
+ * // result.text === "Hello world!"
484
+ * ```
485
+ *
486
+ * In this mode, you can rely on path-related information like __DIR__
487
+ * or __FILE__.
488
+ *
489
+ * Under the hood, the PHP file is executed with the `php_execute_script`
490
+ * C function.
491
+ *
492
+ * The `run()` method cannot be used in conjunction with `cli()`.
493
+ *
409
494
  * @example
410
495
  * ```js
411
- * console.log(await php.run(`<?php
496
+ * const result = await php.run(`<?php
412
497
  * $fp = fopen('php://stderr', 'w');
413
498
  * fwrite($fp, "Hello, world!");
414
- * `));
415
- * // {"exitCode":0,"stdout":"","stderr":["Hello, world!"]}
499
+ * `);
500
+ * // result.errors === "Hello, world!"
416
501
  * ```
417
502
  *
418
- * @param options - PHP run options.
503
+ * @param options - PHP runtime options.
419
504
  */
420
505
  run(options: PHPRunOptions): Promise<PHPResponse>;
421
506
  }
@@ -926,7 +1011,7 @@ export declare class SemaphoreResource<T extends Resource> extends DecoratedReso
926
1011
  }
927
1012
  export interface ActivatePluginStep {
928
1013
  step: "activatePlugin";
929
- plugin: string;
1014
+ pluginPath: string;
930
1015
  }
931
1016
  /**
932
1017
  * Activates a WordPress plugin in the Playground.
@@ -1004,14 +1089,19 @@ export interface ImportFileStep<ResourceType> {
1004
1089
  */
1005
1090
  export declare const importFile: StepHandler<ImportFileStep<File>>;
1006
1091
  /**
1007
- * The step to install a WordPress plugin in the Playground.
1008
- *
1092
+ * @inheritDoc installPlugin
1093
+ * @hasRunnableExample
1094
+ * @needsLogin
1095
+ * @landingPage /wp-admin/plugins.php
1009
1096
  * @example
1010
1097
  *
1011
1098
  * <code>
1012
1099
  * {
1013
1100
  * "step": "installPlugin",
1014
- * "pluginZipFile": "http://example.com/plugin.zip",
1101
+ * "pluginZipFile": {
1102
+ * "resource": "wordpress.org/plugins",
1103
+ * "slug": "gutenberg"
1104
+ * },
1015
1105
  * "options": {
1016
1106
  * "activate": true
1017
1107
  * }
@@ -1048,10 +1138,43 @@ export interface InstallPluginOptions {
1048
1138
  * @param options Optional. Set `activate` to false if you don't want to activate the plugin.
1049
1139
  */
1050
1140
  export declare const installPlugin: StepHandler<InstallPluginStep<File>>;
1141
+ /**
1142
+ * @inheritDoc installTheme
1143
+ * @hasRunnableExample
1144
+ * @needsLogin
1145
+ * @example
1146
+ *
1147
+ * <code>
1148
+ * {
1149
+ * "step": "installTheme",
1150
+ * "themeZipFile": {
1151
+ * "resource": "wordpress.org/themes",
1152
+ * "slug": "pendant"
1153
+ * },
1154
+ * "options": {
1155
+ * "activate": true
1156
+ * }
1157
+ * }
1158
+ * </code>
1159
+ */
1051
1160
  export interface InstallThemeStep<ResourceType> {
1161
+ /**
1162
+ * The step identifier.
1163
+ */
1052
1164
  step: "installTheme";
1165
+ /**
1166
+ * The theme zip file to install.
1167
+ */
1053
1168
  themeZipFile: ResourceType;
1054
- options?: InstallThemeOptions;
1169
+ /**
1170
+ * Optional installation options.
1171
+ */
1172
+ options?: {
1173
+ /**
1174
+ * Whether to activate the theme after installing it.
1175
+ */
1176
+ activate?: boolean;
1177
+ };
1055
1178
  }
1056
1179
  export interface InstallThemeOptions {
1057
1180
  /**
@@ -1069,19 +1192,34 @@ export interface InstallThemeOptions {
1069
1192
  * @param options Optional. Set `activate` to false if you don't want to activate the theme.
1070
1193
  */
1071
1194
  export declare const installTheme: StepHandler<InstallThemeStep<File>>;
1195
+ /**
1196
+ * @inheritDoc login
1197
+ * @hasRunnableExample
1198
+ * @example
1199
+ *
1200
+ * <code>
1201
+ * {
1202
+ * "step": "login",
1203
+ * "username": "admin",
1204
+ * "password": "password"
1205
+ * }
1206
+ * </code>
1207
+ */
1072
1208
  export type LoginStep = {
1073
1209
  step: "login";
1210
+ /**
1211
+ * The user to log in as. Defaults to 'admin'.
1212
+ */
1074
1213
  username?: string;
1214
+ /**
1215
+ * The password to log in with. Defaults to 'password'.
1216
+ */
1075
1217
  password?: string;
1076
1218
  };
1077
1219
  /**
1078
1220
  * Logs in to the Playground.
1079
1221
  * Under the hood, this function submits the wp-login.php form
1080
1222
  * just like a user would.
1081
- *
1082
- * @param playground The playground client.
1083
- * @param user The user to log in as. Defaults to 'admin'.
1084
- * @param password The password to log in with. Defaults to 'password'.
1085
1223
  */
1086
1224
  export declare const login: StepHandler<LoginStep>;
1087
1225
  export interface RunWpInstallationWizardStep {
@@ -1099,70 +1237,287 @@ export interface WordPressInstallationOptions {
1099
1237
  * @param options Installation options.
1100
1238
  */
1101
1239
  export declare const runWpInstallationWizard: StepHandler<RunWpInstallationWizardStep>;
1240
+ /**
1241
+ * @inheritDoc setSiteOptions
1242
+ * @hasRunnableExample
1243
+ *
1244
+ * @example
1245
+ *
1246
+ * <code>
1247
+ * {
1248
+ * "step": "setSiteOptions",
1249
+ * "options": {
1250
+ * "blogname": "My Blog",
1251
+ * "blogdescription": "A great blog"
1252
+ * }
1253
+ * }
1254
+ * </code>
1255
+ */
1102
1256
  export type SetSiteOptionsStep = {
1257
+ /** The name of the step. Must be "setSiteOptions". */
1103
1258
  step: "setSiteOptions";
1259
+ /** The options to set on the site. */
1104
1260
  options: Record<string, unknown>;
1105
1261
  };
1262
+ /**
1263
+ * Sets site options. This is equivalent to calling `update_option` for each
1264
+ * option in the `options` object.
1265
+ */
1106
1266
  export declare const setSiteOptions: StepHandler<SetSiteOptionsStep>;
1267
+ /**
1268
+ * @inheritDoc updateUserMeta
1269
+ * @hasRunnableExample
1270
+ *
1271
+ * @example
1272
+ *
1273
+ * <code>
1274
+ * {
1275
+ * "step": "updateUserMeta",
1276
+ * "meta": {
1277
+ * "first_name": "John",
1278
+ * "last_name": "Doe"
1279
+ * },
1280
+ * "userId": 1
1281
+ * }
1282
+ * </code>
1283
+ */
1107
1284
  export interface UpdateUserMetaStep {
1108
1285
  step: "updateUserMeta";
1109
1286
  meta: Record<string, unknown>;
1110
1287
  userId: number;
1111
1288
  }
1289
+ /**
1290
+ * Updates user meta. This is equivalent to calling `update_user_meta` for each
1291
+ * meta value in the `meta` object.
1292
+ */
1112
1293
  export declare const updateUserMeta: StepHandler<UpdateUserMetaStep>;
1294
+ /**
1295
+ * @inheritDoc runPHP
1296
+ * @hasRunnableExample
1297
+ * @example
1298
+ *
1299
+ * <code>
1300
+ * {
1301
+ * "step": "runPHP",
1302
+ * "code": "<?php echo 'Hello World'; ?>"
1303
+ * }
1304
+ * </code>
1305
+ */
1113
1306
  export interface RunPHPStep {
1307
+ /** The step identifier. */
1114
1308
  step: "runPHP";
1309
+ /** The PHP code to run. */
1115
1310
  code: string;
1116
1311
  }
1312
+ /**
1313
+ * Runs PHP code.
1314
+ */
1117
1315
  export declare const runPHP: StepHandler<RunPHPStep>;
1316
+ /**
1317
+ * @inheritDoc runPHP
1318
+ * @hasRunnableExample
1319
+ * @example
1320
+ *
1321
+ * <code>
1322
+ * {
1323
+ * "step": "runPHP",
1324
+ * "options": {
1325
+ * "code": "<?php echo $_SERVER['HTTP_CONTENT_TYPE']; ?>",
1326
+ * "headers": {
1327
+ * "Content-type": "text/plain"
1328
+ * }
1329
+ * }
1330
+ * }
1331
+ * </code>
1332
+ */
1118
1333
  export interface RunPHPWithOptionsStep {
1119
1334
  step: "runPHPWithOptions";
1120
1335
  options: PHPRunOptions;
1121
1336
  }
1337
+ /**
1338
+ * Runs PHP code with the given options.
1339
+ */
1122
1340
  export declare const runPHPWithOptions: StepHandler<RunPHPWithOptionsStep>;
1341
+ /**
1342
+ * @inheritDoc setPhpIniEntry
1343
+ * @hasRunnableExample
1344
+ * @example
1345
+ *
1346
+ * <code>
1347
+ * {
1348
+ * "step": "setPhpIniEntry",
1349
+ * "key": "display_errors",
1350
+ * "value": "1"
1351
+ * }
1352
+ * </code>
1353
+ */
1123
1354
  export interface SetPhpIniEntryStep {
1124
1355
  step: "setPhpIniEntry";
1125
1356
  key: string;
1126
1357
  value: string;
1127
1358
  }
1359
+ /**
1360
+ * Sets a PHP ini entry.
1361
+ */
1128
1362
  export declare const setPhpIniEntry: StepHandler<SetPhpIniEntryStep>;
1363
+ /**
1364
+ * @inheritDoc request
1365
+ * @needsLogin
1366
+ * @hasRunnableExample
1367
+ * @example
1368
+ *
1369
+ * <code>
1370
+ * {
1371
+ * "step": "request",
1372
+ * "request": {
1373
+ * "method": "POST",
1374
+ * "url": "/wp-admin/admin-ajax.php",
1375
+ * "formData": {
1376
+ * "action": "my_action",
1377
+ * "foo": "bar"
1378
+ * }
1379
+ * }
1380
+ * }
1381
+ * </code>
1382
+ */
1129
1383
  export interface RequestStep {
1130
1384
  step: "request";
1131
1385
  request: PHPRequest;
1132
1386
  }
1387
+ /**
1388
+ * Sends a HTTP request to the Playground.
1389
+ */
1133
1390
  export declare const request: StepHandler<RequestStep>;
1391
+ /**
1392
+ * @inheritDoc cp
1393
+ * @hasRunnableExample
1394
+ * @landingPage /index2.php
1395
+ * @example
1396
+ *
1397
+ * <code>
1398
+ * {
1399
+ * "step": "cp",
1400
+ * "fromPath": "/wordpress/index.php",
1401
+ * "toPath": "/wordpress/index2.php"
1402
+ * }
1403
+ * </code>
1404
+ */
1134
1405
  export interface CpStep {
1135
1406
  step: "cp";
1136
1407
  fromPath: string;
1137
1408
  toPath: string;
1138
1409
  }
1410
+ /**
1411
+ * Copies a file from one path to another.
1412
+ */
1139
1413
  export declare const cp: StepHandler<CpStep>;
1414
+ /**
1415
+ * @inheritDoc mv
1416
+ * @hasRunnableExample
1417
+ * @landingPage /index2.php
1418
+ * @example
1419
+ *
1420
+ * <code>
1421
+ * {
1422
+ * "step": "mv",
1423
+ * "fromPath": "/wordpress/index.php",
1424
+ * "toPath": "/wordpress/index2.php"
1425
+ * }
1426
+ * </code>
1427
+ */
1140
1428
  export interface MvStep {
1141
1429
  step: "mv";
1142
1430
  fromPath: string;
1143
1431
  toPath: string;
1144
1432
  }
1433
+ /**
1434
+ * Moves a file or directory from one path to another.
1435
+ */
1145
1436
  export declare const mv: StepHandler<MvStep>;
1437
+ /**
1438
+ * @inheritDoc mkdir
1439
+ * @hasRunnableExample
1440
+ * @example
1441
+ *
1442
+ * <code>
1443
+ * {
1444
+ * "step": "mkdir",
1445
+ * "path": "/wordpress/my-new-folder"
1446
+ * }
1447
+ * </code>
1448
+ */
1146
1449
  export interface MkdirStep {
1147
1450
  step: "mkdir";
1148
1451
  path: string;
1149
1452
  }
1453
+ /**
1454
+ * Creates a directory at the specified path.
1455
+ */
1150
1456
  export declare const mkdir: StepHandler<MkdirStep>;
1457
+ /**
1458
+ * @inheritDoc rm
1459
+ * @hasRunnableExample
1460
+ * @landingPage /index.php
1461
+ * @example
1462
+ *
1463
+ * <code>
1464
+ * {
1465
+ * "step": "rm",
1466
+ * "path": "/wordpress/index.php"
1467
+ * }
1468
+ * </code>
1469
+ */
1151
1470
  export interface RmStep {
1152
1471
  step: "rm";
1153
1472
  path: string;
1154
1473
  }
1474
+ /**
1475
+ * Removes a file at the specified path.
1476
+ */
1155
1477
  export declare const rm: StepHandler<RmStep>;
1478
+ /**
1479
+ * @inheritDoc rmdir
1480
+ * @hasRunnableExample
1481
+ * @landingPage /wp-admin/
1482
+ * @example
1483
+ *
1484
+ * <code>
1485
+ * {
1486
+ * "step": "rm",
1487
+ * "path": "/wordpress/wp-admin"
1488
+ * }
1489
+ * </code>
1490
+ */
1156
1491
  export interface RmdirStep {
1157
1492
  step: "rmdir";
1158
1493
  path: string;
1159
1494
  }
1495
+ /**
1496
+ * Removes a directory at the specified path.
1497
+ */
1160
1498
  export declare const rmdir: StepHandler<RmdirStep>;
1499
+ /**
1500
+ * @inheritDoc writeFile
1501
+ * @hasRunnableExample
1502
+ * @landingPage /test.php
1503
+ * @example
1504
+ *
1505
+ * <code>
1506
+ * {
1507
+ * "step": "writeFile",
1508
+ * "path": "/wordpress/test.php",
1509
+ * "data": "<?php echo 'Hello World!'; ?>"
1510
+ * }
1511
+ * </code>
1512
+ */
1161
1513
  export interface WriteFileStep<ResourceType> {
1162
1514
  step: "writeFile";
1163
1515
  path: string;
1164
1516
  data: ResourceType | string | Uint8Array;
1165
1517
  }
1518
+ /**
1519
+ * Writes data to a file at the specified path.
1520
+ */
1166
1521
  export declare const writeFile: StepHandler<WriteFileStep<File>>;
1167
1522
  /**
1168
1523
  * The step object for defining constants in the wp-config.php file of a WordPress installation.
@@ -1179,6 +1534,17 @@ export interface DefineWpConfigConstsStep {
1179
1534
  * @param wpConfigConst
1180
1535
  */
1181
1536
  export declare const defineWpConfigConsts: StepHandler<DefineWpConfigConstsStep>;
1537
+ export interface ActivateThemeStep {
1538
+ step: "activateTheme";
1539
+ themeFolderName: string;
1540
+ }
1541
+ /**
1542
+ * Activates a WordPress theme in the Playground.
1543
+ *
1544
+ * @param playground The playground client.
1545
+ * @param themeFolderName The theme folder name.
1546
+ */
1547
+ export declare const activateTheme: StepHandler<ActivateThemeStep>;
1182
1548
  /**
1183
1549
  * The step object for defining constants in the VFS_CONFIG_FILE_PATH php file and loaded using the auto_prepend_file php.ini directive.
1184
1550
  */
@@ -1204,8 +1570,20 @@ export type StepDefinition = Step & {
1204
1570
  caption?: string;
1205
1571
  };
1206
1572
  };
1207
- export type GenericStep<Resource> = ActivatePluginStep | ApplyWordPressPatchesStep | CpStep | DefineWpConfigConstsStep | DefineVirtualWpConfigConstsStep | DefineSiteUrlStep | ImportFileStep<Resource> | InstallPluginStep<Resource> | InstallThemeStep<Resource> | LoginStep | MkdirStep | MvStep | RequestStep | ReplaceSiteStep<Resource> | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | SetPhpIniEntryStep | SetSiteOptionsStep | UnzipStep | UpdateUserMetaStep | WriteFileStep<Resource>;
1208
- export type StepHandler<S extends GenericStep<File>> = (php: UniversalPHP, args: Omit<S, "step">, progressArgs?: {
1573
+ /**
1574
+ * If you add a step here, make sure to also
1575
+ * add it to the exports below.
1576
+ */
1577
+ export type GenericStep<Resource> = ActivatePluginStep | ActivateThemeStep | ApplyWordPressPatchesStep | CpStep | DefineWpConfigConstsStep | DefineVirtualWpConfigConstsStep | DefineSiteUrlStep | ImportFileStep<Resource> | InstallPluginStep<Resource> | InstallThemeStep<Resource> | LoginStep | MkdirStep | MvStep | RequestStep | ReplaceSiteStep<Resource> | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | SetPhpIniEntryStep | SetSiteOptionsStep | UnzipStep | UpdateUserMetaStep | WriteFileStep<Resource>;
1578
+ export type StepHandler<S extends GenericStep<File>> = (
1579
+ /**
1580
+ * A PHP instance or Playground client.
1581
+ */
1582
+ php: UniversalPHP, args: Omit<S, "step">,
1583
+ /**
1584
+ * Progress reporting details.
1585
+ */
1586
+ progressArgs?: {
1209
1587
  tracker: ProgressTracker;
1210
1588
  initialCaption?: string;
1211
1589
  }) => any;
@@ -1282,7 +1660,7 @@ export type WithAPIState = {
1282
1660
  */
1283
1661
  isReady: () => Promise<void>;
1284
1662
  };
1285
- export type RemoteAPI<T> = Comlink.Remote<T & WithAPIState>;
1663
+ export type RemoteAPI<T> = Comlink.Remote<T> & WithAPIState;
1286
1664
  export interface PHPWebLoaderOptions {
1287
1665
  emscriptenOptions?: EmscriptenOptions;
1288
1666
  downloadMonitor?: EmscriptenDownloadMonitor;
@@ -1317,20 +1695,23 @@ declare class WebPHP extends BasePHP {
1317
1695
  };
1318
1696
  }
1319
1697
  declare class WebPHPEndpoint implements IsomorphicLocalPHP {
1320
- /** @inheritDoc */
1698
+ /** @inheritDoc @php-wasm/universal!RequestHandler.absoluteUrl */
1321
1699
  absoluteUrl: string;
1322
- /** @inheritDoc */
1700
+ /** @inheritDoc @php-wasm/universal!RequestHandler.documentRoot */
1323
1701
  documentRoot: string;
1324
1702
  /** @inheritDoc */
1325
1703
  constructor(php: BasePHP, monitor?: EmscriptenDownloadMonitor);
1326
- /** @inheritDoc */
1704
+ /** @inheritDoc @php-wasm/universal!RequestHandler.pathToInternalUrl */
1327
1705
  pathToInternalUrl(path: string): string;
1328
- /** @inheritDoc */
1706
+ /** @inheritDoc @php-wasm/universal!RequestHandler.internalUrlToPath */
1329
1707
  internalUrlToPath(internalUrl: string): string;
1708
+ /**
1709
+ * The onDownloadProgress event listener.
1710
+ */
1330
1711
  onDownloadProgress(callback: (progress: CustomEvent<ProgressEvent>) => void): Promise<void>;
1331
- /** @inheritDoc */
1712
+ /** @inheritDoc @php-wasm/universal!IsomorphicLocalPHP.mv */
1332
1713
  mv(fromPath: string, toPath: string): void;
1333
- /** @inheritDoc */
1714
+ /** @inheritDoc @php-wasm/universal!IsomorphicLocalPHP.rmdir */
1334
1715
  rmdir(path: string, options?: RmDirOptions): void;
1335
1716
  /** @inheritDoc @php-wasm/universal!RequestHandler.request */
1336
1717
  request(request: PHPRequest, redirects?: number): Promise<PHPResponse>;
@@ -1362,10 +1743,22 @@ declare class WebPHPEndpoint implements IsomorphicLocalPHP {
1362
1743
  fileExists(path: string): boolean;
1363
1744
  }
1364
1745
  declare class PlaygroundWorkerEndpoint extends WebPHPEndpoint {
1746
+ /**
1747
+ * A string representing the scope of the Playground instance.
1748
+ */
1365
1749
  scope: string;
1750
+ /**
1751
+ * A string representing the version of WordPress being used.
1752
+ */
1366
1753
  wordPressVersion: string;
1754
+ /**
1755
+ * A string representing the version of PHP being used.
1756
+ */
1367
1757
  phpVersion: string;
1368
1758
  constructor(php: WebPHP, monitor: EmscriptenDownloadMonitor, scope: string, wordPressVersion: string, phpVersion: string);
1759
+ /**
1760
+ * @returns WordPress module details, including the static assets directory and default theme.
1761
+ */
1369
1762
  getWordPressModuleDetails(): Promise<{
1370
1763
  staticAssetsDirectory: string;
1371
1764
  defaultTheme: any;
@@ -1378,18 +1771,44 @@ export interface ProgressBarOptions {
1378
1771
  visible?: boolean;
1379
1772
  }
1380
1773
  export interface WebClientMixin extends ProgressReceiver {
1774
+ /**
1775
+ * Sets the progress bar options.
1776
+ * @param options The progress bar options.
1777
+ */
1381
1778
  setProgress(options: ProgressBarOptions): Promise<void>;
1779
+ /**
1780
+ * Sets the loaded state.
1781
+ */
1382
1782
  setLoaded(): Promise<void>;
1783
+ /**
1784
+ * Sets the navigation event listener.
1785
+ * @param fn The function to be called when a navigation event occurs.
1786
+ */
1383
1787
  onNavigation(fn: (url: string) => void): Promise<void>;
1788
+ /**
1789
+ * Navigates to the requested path.
1790
+ * @param requestedPath The requested path.
1791
+ */
1384
1792
  goTo(requestedPath: string): Promise<void>;
1793
+ /**
1794
+ * Gets the current URL.
1795
+ */
1385
1796
  getCurrentURL(): Promise<string>;
1797
+ /**
1798
+ * Sets the iframe sandbox flags.
1799
+ * @param flags The iframe sandbox flags.
1800
+ */
1386
1801
  setIframeSandboxFlags(flags: string[]): Promise<void>;
1802
+ /**
1803
+ * The onDownloadProgress event listener.
1804
+ */
1387
1805
  onDownloadProgress: PlaygroundWorkerEndpoint["onDownloadProgress"];
1388
1806
  }
1389
1807
  /**
1390
- * @inheritDoc
1808
+ * The Playground Client interface.
1391
1809
  */
1392
- export type PlaygroundClient = RemoteAPI<PlaygroundWorkerEndpoint & WebClientMixin>;
1810
+ export interface PlaygroundClient extends RemoteAPI<PlaygroundWorkerEndpoint & WebClientMixin> {
1811
+ }
1393
1812
  export interface StartPlaygroundOptions {
1394
1813
  iframe: HTMLIFrameElement;
1395
1814
  remoteUrl: string;