@wp-playground/client 0.1.61 → 0.3.0
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/README.md +2 -1
- package/index.cjs +359 -34
- package/index.d.ts +256 -117
- package/index.js +7660 -1236
- package/package.json +6 -2
- package/blueprint-schema.json +0 -1276
package/index.d.ts
CHANGED
|
@@ -274,7 +274,7 @@ export interface RequestHandler {
|
|
|
274
274
|
* }
|
|
275
275
|
* })
|
|
276
276
|
* php.writeFile("/www/index.php", `<?php echo file_get_contents("php://input");`);
|
|
277
|
-
* const result = await php.
|
|
277
|
+
* const result = await php.request({
|
|
278
278
|
* method: "GET",
|
|
279
279
|
* headers: {
|
|
280
280
|
* "Content-Type": "text/plain"
|
|
@@ -512,7 +512,7 @@ export interface IsomorphicLocalPHP extends RequestHandler {
|
|
|
512
512
|
* post_message_to_js(string $data)
|
|
513
513
|
*
|
|
514
514
|
* Arguments:
|
|
515
|
-
* $data –
|
|
515
|
+
* $data (string) – Data to pass to JavaScript.
|
|
516
516
|
*
|
|
517
517
|
* @example
|
|
518
518
|
*
|
|
@@ -668,6 +668,8 @@ export declare const SupportedPHPVersions: readonly [
|
|
|
668
668
|
export declare const LatestSupportedPHPVersion: "8.2";
|
|
669
669
|
export declare const SupportedPHPVersionsList: string[];
|
|
670
670
|
export type SupportedPHPVersion = (typeof SupportedPHPVersions)[number];
|
|
671
|
+
export type SupportedPHPExtension = "iconv" | "mbstring" | "xml-bundle" | "gd";
|
|
672
|
+
export type SupportedPHPExtensionBundle = "kitchen-sink";
|
|
671
673
|
export interface PHPRequestHandlerConfiguration {
|
|
672
674
|
/**
|
|
673
675
|
* The directory in the PHP filesystem where the server will look
|
|
@@ -678,11 +680,6 @@ export interface PHPRequestHandlerConfiguration {
|
|
|
678
680
|
* Request Handler URL. Used to populate $_SERVER details like HTTP_HOST.
|
|
679
681
|
*/
|
|
680
682
|
absoluteUrl?: string;
|
|
681
|
-
/**
|
|
682
|
-
* Callback used by the PHPRequestHandler to decide whether
|
|
683
|
-
* the requested path refers to a PHP file or a static file.
|
|
684
|
-
*/
|
|
685
|
-
isStaticFilePath?: (path: string) => boolean;
|
|
686
683
|
}
|
|
687
684
|
/** @inheritDoc */
|
|
688
685
|
export declare class PHPRequestHandler implements RequestHandler {
|
|
@@ -1062,17 +1059,34 @@ export declare class SemaphoreResource<T extends Resource> extends DecoratedReso
|
|
|
1062
1059
|
/** @inheritDoc */
|
|
1063
1060
|
resolve(): Promise<File>;
|
|
1064
1061
|
}
|
|
1062
|
+
/**
|
|
1063
|
+
* @inheritDoc activatePlugin
|
|
1064
|
+
* @example
|
|
1065
|
+
*
|
|
1066
|
+
* <code>
|
|
1067
|
+
* {
|
|
1068
|
+
* "step": "activatePlugin",
|
|
1069
|
+
* "pluginName": "Gutenberg",
|
|
1070
|
+
* "pluginPath": "/wordpress/wp-content/plugins/gutenberg"
|
|
1071
|
+
* }
|
|
1072
|
+
* </code>
|
|
1073
|
+
*/
|
|
1065
1074
|
export interface ActivatePluginStep {
|
|
1066
1075
|
step: "activatePlugin";
|
|
1076
|
+
/** Path to the plugin directory as absolute path (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file relative to the plugins directory (plugin-name/plugin-name.php). */
|
|
1067
1077
|
pluginPath: string;
|
|
1078
|
+
/** Optional. Plugin name to display in the progress bar. */
|
|
1068
1079
|
pluginName?: string;
|
|
1069
1080
|
}
|
|
1070
1081
|
/**
|
|
1071
|
-
* Activates a WordPress plugin
|
|
1082
|
+
* Activates a WordPress plugin (if it's installed).
|
|
1072
1083
|
*
|
|
1073
1084
|
* @param playground The playground client.
|
|
1074
1085
|
*/
|
|
1075
1086
|
export declare const activatePlugin: StepHandler<ActivatePluginStep>;
|
|
1087
|
+
/**
|
|
1088
|
+
* @private
|
|
1089
|
+
*/
|
|
1076
1090
|
export interface ApplyWordPressPatchesStep {
|
|
1077
1091
|
step: "applyWordPressPatches";
|
|
1078
1092
|
siteUrl?: string;
|
|
@@ -1081,14 +1095,29 @@ export interface ApplyWordPressPatchesStep {
|
|
|
1081
1095
|
patchSecrets?: boolean;
|
|
1082
1096
|
disableSiteHealth?: boolean;
|
|
1083
1097
|
disableWpNewBlogNotification?: boolean;
|
|
1098
|
+
makeEditorFrameControlled?: boolean;
|
|
1099
|
+
prepareForRunningInsideWebBrowser?: boolean;
|
|
1084
1100
|
}
|
|
1085
1101
|
export declare const applyWordPressPatches: StepHandler<ApplyWordPressPatchesStep>;
|
|
1102
|
+
/**
|
|
1103
|
+
* @inheritDoc defineSiteUrl
|
|
1104
|
+
* @hasRunnableExample
|
|
1105
|
+
* @example
|
|
1106
|
+
*
|
|
1107
|
+
* <code>
|
|
1108
|
+
* {
|
|
1109
|
+
* "step": "defineSiteUrl",
|
|
1110
|
+
* "siteUrl": "https://playground.wordpress.net"
|
|
1111
|
+
* }
|
|
1112
|
+
* </code>
|
|
1113
|
+
*/
|
|
1086
1114
|
export interface DefineSiteUrlStep {
|
|
1087
1115
|
step: "defineSiteUrl";
|
|
1116
|
+
/** The URL */
|
|
1088
1117
|
siteUrl: string;
|
|
1089
1118
|
}
|
|
1090
1119
|
/**
|
|
1091
|
-
* Sets
|
|
1120
|
+
* Sets WP_HOME and WP_SITEURL constants for the WordPress installation.
|
|
1092
1121
|
*
|
|
1093
1122
|
* @param playground The playground client.
|
|
1094
1123
|
* @param siteUrl
|
|
@@ -1103,20 +1132,48 @@ export declare const defineSiteUrl: StepHandler<DefineSiteUrlStep>;
|
|
|
1103
1132
|
* @param playground Playground client.
|
|
1104
1133
|
*/
|
|
1105
1134
|
export declare function zipEntireSite(playground: UniversalPHP): Promise<File>;
|
|
1135
|
+
/**
|
|
1136
|
+
* @inheritDoc replaceSite
|
|
1137
|
+
* @example
|
|
1138
|
+
*
|
|
1139
|
+
* <code>
|
|
1140
|
+
* {
|
|
1141
|
+
* "step": "replaceSite",
|
|
1142
|
+
* "fullSiteZip": "https://mysite.com/import.zip"
|
|
1143
|
+
* }
|
|
1144
|
+
* </code>
|
|
1145
|
+
*/
|
|
1106
1146
|
export interface ReplaceSiteStep<ResourceType> {
|
|
1107
1147
|
step: "replaceSite";
|
|
1148
|
+
/** The zip file containing the new WordPress site */
|
|
1108
1149
|
fullSiteZip: ResourceType;
|
|
1109
1150
|
}
|
|
1110
1151
|
/**
|
|
1111
|
-
* Replace the current site with
|
|
1152
|
+
* Replace the current site with a site from the provided zip file.
|
|
1153
|
+
* Remember to install the SQLite integration plugin in the zipped site:
|
|
1154
|
+
* https://wordpress.org/plugins/sqlite-database-integration.
|
|
1112
1155
|
*
|
|
1113
1156
|
* @param playground Playground client.
|
|
1114
1157
|
* @param fullSiteZip Zipped WordPress site.
|
|
1115
1158
|
*/
|
|
1116
1159
|
export declare const replaceSite: StepHandler<ReplaceSiteStep<File>>;
|
|
1160
|
+
/**
|
|
1161
|
+
* @inheritDoc unzip
|
|
1162
|
+
* @example
|
|
1163
|
+
*
|
|
1164
|
+
* <code>
|
|
1165
|
+
* {
|
|
1166
|
+
* "step": "unzip",
|
|
1167
|
+
* "zipPath": "/wordpress/data.zip",
|
|
1168
|
+
* "extractToPath": "/wordpress"
|
|
1169
|
+
* }
|
|
1170
|
+
* </code>
|
|
1171
|
+
*/
|
|
1117
1172
|
export interface UnzipStep {
|
|
1118
1173
|
step: "unzip";
|
|
1174
|
+
/** The zip file to extract */
|
|
1119
1175
|
zipPath: string;
|
|
1176
|
+
/** The path to extract the zip file to */
|
|
1120
1177
|
extractToPath: string;
|
|
1121
1178
|
}
|
|
1122
1179
|
/**
|
|
@@ -1127,8 +1184,20 @@ export interface UnzipStep {
|
|
|
1127
1184
|
* @param extractTo The directory to extract the zip file to.
|
|
1128
1185
|
*/
|
|
1129
1186
|
export declare const unzip: StepHandler<UnzipStep>;
|
|
1187
|
+
/**
|
|
1188
|
+
* @inheritDoc importFile
|
|
1189
|
+
* @example
|
|
1190
|
+
*
|
|
1191
|
+
* <code>
|
|
1192
|
+
* {
|
|
1193
|
+
* "step": "importFile",
|
|
1194
|
+
* "file": "https://mysite.com/import.WXR"
|
|
1195
|
+
* }
|
|
1196
|
+
* </code>
|
|
1197
|
+
*/
|
|
1130
1198
|
export interface ImportFileStep<ResourceType> {
|
|
1131
1199
|
step: "importFile";
|
|
1200
|
+
/** The file to import */
|
|
1132
1201
|
file: ResourceType;
|
|
1133
1202
|
}
|
|
1134
1203
|
/**
|
|
@@ -1270,6 +1339,9 @@ export type LoginStep = {
|
|
|
1270
1339
|
* just like a user would.
|
|
1271
1340
|
*/
|
|
1272
1341
|
export declare const login: StepHandler<LoginStep>;
|
|
1342
|
+
/**
|
|
1343
|
+
* @private
|
|
1344
|
+
*/
|
|
1273
1345
|
export interface RunWpInstallationWizardStep {
|
|
1274
1346
|
step: "runWpInstallationWizard";
|
|
1275
1347
|
options: WordPressInstallationOptions;
|
|
@@ -1331,7 +1403,9 @@ export declare const setSiteOptions: StepHandler<SetSiteOptionsStep>;
|
|
|
1331
1403
|
*/
|
|
1332
1404
|
export interface UpdateUserMetaStep {
|
|
1333
1405
|
step: "updateUserMeta";
|
|
1406
|
+
/** An object of user meta values to set, e.g. { "first_name": "John" } */
|
|
1334
1407
|
meta: Record<string, unknown>;
|
|
1408
|
+
/** User ID */
|
|
1335
1409
|
userId: number;
|
|
1336
1410
|
}
|
|
1337
1411
|
/**
|
|
@@ -1340,210 +1414,225 @@ export interface UpdateUserMetaStep {
|
|
|
1340
1414
|
*/
|
|
1341
1415
|
export declare const updateUserMeta: StepHandler<UpdateUserMetaStep>;
|
|
1342
1416
|
/**
|
|
1343
|
-
* @inheritDoc
|
|
1417
|
+
* @inheritDoc rm
|
|
1344
1418
|
* @hasRunnableExample
|
|
1419
|
+
* @landingPage /index.php
|
|
1345
1420
|
* @example
|
|
1346
1421
|
*
|
|
1347
1422
|
* <code>
|
|
1348
1423
|
* {
|
|
1349
|
-
* "step": "
|
|
1350
|
-
* "
|
|
1424
|
+
* "step": "rm",
|
|
1425
|
+
* "path": "/wordpress/index.php"
|
|
1351
1426
|
* }
|
|
1352
1427
|
* </code>
|
|
1353
1428
|
*/
|
|
1354
|
-
export interface
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
code: string;
|
|
1429
|
+
export interface RmStep {
|
|
1430
|
+
step: "rm";
|
|
1431
|
+
/** The path to remove */
|
|
1432
|
+
path: string;
|
|
1359
1433
|
}
|
|
1360
1434
|
/**
|
|
1361
|
-
*
|
|
1435
|
+
* Removes a file at the specified path.
|
|
1362
1436
|
*/
|
|
1363
|
-
export declare const
|
|
1437
|
+
export declare const rm: StepHandler<RmStep>;
|
|
1364
1438
|
/**
|
|
1365
|
-
* @inheritDoc
|
|
1439
|
+
* @inheritDoc cp
|
|
1366
1440
|
* @hasRunnableExample
|
|
1441
|
+
* @landingPage /index2.php
|
|
1367
1442
|
* @example
|
|
1368
1443
|
*
|
|
1369
1444
|
* <code>
|
|
1370
1445
|
* {
|
|
1371
|
-
* "step": "
|
|
1372
|
-
* "
|
|
1373
|
-
*
|
|
1374
|
-
* "headers": {
|
|
1375
|
-
* "Content-type": "text/plain"
|
|
1376
|
-
* }
|
|
1377
|
-
* }
|
|
1446
|
+
* "step": "cp",
|
|
1447
|
+
* "fromPath": "/wordpress/index.php",
|
|
1448
|
+
* "toPath": "/wordpress/index2.php"
|
|
1378
1449
|
* }
|
|
1379
1450
|
* </code>
|
|
1380
1451
|
*/
|
|
1381
|
-
export interface
|
|
1382
|
-
step: "
|
|
1383
|
-
|
|
1452
|
+
export interface CpStep {
|
|
1453
|
+
step: "cp";
|
|
1454
|
+
/** Source path */
|
|
1455
|
+
fromPath: string;
|
|
1456
|
+
/** Target path */
|
|
1457
|
+
toPath: string;
|
|
1384
1458
|
}
|
|
1385
1459
|
/**
|
|
1386
|
-
*
|
|
1460
|
+
* Copies a file from one path to another.
|
|
1387
1461
|
*/
|
|
1388
|
-
export declare const
|
|
1462
|
+
export declare const cp: StepHandler<CpStep>;
|
|
1389
1463
|
/**
|
|
1390
|
-
* @inheritDoc
|
|
1464
|
+
* @inheritDoc rmdir
|
|
1391
1465
|
* @hasRunnableExample
|
|
1466
|
+
* @landingPage /wp-admin/
|
|
1392
1467
|
* @example
|
|
1393
1468
|
*
|
|
1394
1469
|
* <code>
|
|
1395
1470
|
* {
|
|
1396
|
-
* "step": "
|
|
1397
|
-
* "
|
|
1398
|
-
* "value": "1"
|
|
1471
|
+
* "step": "rmdir",
|
|
1472
|
+
* "path": "/wordpress/wp-admin"
|
|
1399
1473
|
* }
|
|
1400
1474
|
* </code>
|
|
1401
1475
|
*/
|
|
1402
|
-
export interface
|
|
1403
|
-
step: "
|
|
1404
|
-
|
|
1405
|
-
|
|
1476
|
+
export interface RmdirStep {
|
|
1477
|
+
step: "rmdir";
|
|
1478
|
+
/** The path to remove */
|
|
1479
|
+
path: string;
|
|
1406
1480
|
}
|
|
1407
1481
|
/**
|
|
1408
|
-
*
|
|
1482
|
+
* Removes a directory at the specified path.
|
|
1409
1483
|
*/
|
|
1410
|
-
export declare const
|
|
1484
|
+
export declare const rmdir: StepHandler<RmdirStep>;
|
|
1411
1485
|
/**
|
|
1412
|
-
* @inheritDoc
|
|
1413
|
-
* @needsLogin
|
|
1486
|
+
* @inheritDoc mkdir
|
|
1414
1487
|
* @hasRunnableExample
|
|
1415
1488
|
* @example
|
|
1416
1489
|
*
|
|
1417
1490
|
* <code>
|
|
1418
1491
|
* {
|
|
1419
|
-
* "step": "
|
|
1420
|
-
* "
|
|
1421
|
-
* "method": "POST",
|
|
1422
|
-
* "url": "/wp-admin/admin-ajax.php",
|
|
1423
|
-
* "formData": {
|
|
1424
|
-
* "action": "my_action",
|
|
1425
|
-
* "foo": "bar"
|
|
1426
|
-
* }
|
|
1427
|
-
* }
|
|
1492
|
+
* "step": "mkdir",
|
|
1493
|
+
* "path": "/wordpress/my-new-folder"
|
|
1428
1494
|
* }
|
|
1429
1495
|
* </code>
|
|
1430
1496
|
*/
|
|
1431
|
-
export interface
|
|
1432
|
-
step: "
|
|
1433
|
-
|
|
1497
|
+
export interface MkdirStep {
|
|
1498
|
+
step: "mkdir";
|
|
1499
|
+
/** The path of the directory you want to create */
|
|
1500
|
+
path: string;
|
|
1434
1501
|
}
|
|
1435
1502
|
/**
|
|
1436
|
-
*
|
|
1503
|
+
* Creates a directory at the specified path.
|
|
1437
1504
|
*/
|
|
1438
|
-
export declare const
|
|
1505
|
+
export declare const mkdir: StepHandler<MkdirStep>;
|
|
1439
1506
|
/**
|
|
1440
|
-
* @inheritDoc
|
|
1507
|
+
* @inheritDoc mv
|
|
1441
1508
|
* @hasRunnableExample
|
|
1442
1509
|
* @landingPage /index2.php
|
|
1443
1510
|
* @example
|
|
1444
1511
|
*
|
|
1445
1512
|
* <code>
|
|
1446
1513
|
* {
|
|
1447
|
-
* "step": "
|
|
1514
|
+
* "step": "mv",
|
|
1448
1515
|
* "fromPath": "/wordpress/index.php",
|
|
1449
1516
|
* "toPath": "/wordpress/index2.php"
|
|
1450
1517
|
* }
|
|
1451
1518
|
* </code>
|
|
1452
1519
|
*/
|
|
1453
|
-
export interface
|
|
1454
|
-
step: "
|
|
1520
|
+
export interface MvStep {
|
|
1521
|
+
step: "mv";
|
|
1522
|
+
/** Source path */
|
|
1455
1523
|
fromPath: string;
|
|
1524
|
+
/** Target path */
|
|
1456
1525
|
toPath: string;
|
|
1457
1526
|
}
|
|
1458
1527
|
/**
|
|
1459
|
-
*
|
|
1528
|
+
* Moves a file or directory from one path to another.
|
|
1460
1529
|
*/
|
|
1461
|
-
export declare const
|
|
1530
|
+
export declare const mv: StepHandler<MvStep>;
|
|
1462
1531
|
/**
|
|
1463
|
-
* @inheritDoc
|
|
1532
|
+
* @inheritDoc setPhpIniEntry
|
|
1464
1533
|
* @hasRunnableExample
|
|
1465
|
-
* @landingPage /index2.php
|
|
1466
1534
|
* @example
|
|
1467
1535
|
*
|
|
1468
1536
|
* <code>
|
|
1469
1537
|
* {
|
|
1470
|
-
* "step": "
|
|
1471
|
-
* "
|
|
1472
|
-
* "
|
|
1538
|
+
* "step": "setPhpIniEntry",
|
|
1539
|
+
* "key": "display_errors",
|
|
1540
|
+
* "value": "1"
|
|
1473
1541
|
* }
|
|
1474
1542
|
* </code>
|
|
1475
1543
|
*/
|
|
1476
|
-
export interface
|
|
1477
|
-
step: "
|
|
1478
|
-
|
|
1479
|
-
|
|
1544
|
+
export interface SetPhpIniEntryStep {
|
|
1545
|
+
step: "setPhpIniEntry";
|
|
1546
|
+
/** Entry name e.g. "display_errors" */
|
|
1547
|
+
key: string;
|
|
1548
|
+
/** Entry value as a string e.g. "1" */
|
|
1549
|
+
value: string;
|
|
1480
1550
|
}
|
|
1481
1551
|
/**
|
|
1482
|
-
*
|
|
1552
|
+
* Sets a PHP ini entry.
|
|
1483
1553
|
*/
|
|
1484
|
-
export declare const
|
|
1554
|
+
export declare const setPhpIniEntry: StepHandler<SetPhpIniEntryStep>;
|
|
1485
1555
|
/**
|
|
1486
|
-
* @inheritDoc
|
|
1556
|
+
* @inheritDoc runPHP
|
|
1487
1557
|
* @hasRunnableExample
|
|
1488
1558
|
* @example
|
|
1489
1559
|
*
|
|
1490
1560
|
* <code>
|
|
1491
1561
|
* {
|
|
1492
|
-
* "step": "
|
|
1493
|
-
* "
|
|
1562
|
+
* "step": "runPHP",
|
|
1563
|
+
* "code": "<?php require_once 'wordpress/wp-load.php'; wp_insert_post(array('post_title' => 'wp-load.php required for WP functionality', 'post_status' => 'publish')); ?>"
|
|
1494
1564
|
* }
|
|
1495
1565
|
* </code>
|
|
1496
1566
|
*/
|
|
1497
|
-
export interface
|
|
1498
|
-
step
|
|
1499
|
-
|
|
1567
|
+
export interface RunPHPStep {
|
|
1568
|
+
/** The step identifier. */
|
|
1569
|
+
step: "runPHP";
|
|
1570
|
+
/** The PHP code to run. */
|
|
1571
|
+
code: string;
|
|
1500
1572
|
}
|
|
1501
1573
|
/**
|
|
1502
|
-
*
|
|
1574
|
+
* Runs PHP code.
|
|
1503
1575
|
*/
|
|
1504
|
-
export declare const
|
|
1576
|
+
export declare const runPHP: StepHandler<RunPHPStep>;
|
|
1505
1577
|
/**
|
|
1506
|
-
* @inheritDoc
|
|
1578
|
+
* @inheritDoc runPHP
|
|
1507
1579
|
* @hasRunnableExample
|
|
1508
|
-
* @landingPage /index.php
|
|
1509
1580
|
* @example
|
|
1510
1581
|
*
|
|
1511
1582
|
* <code>
|
|
1512
1583
|
* {
|
|
1513
|
-
* "step": "
|
|
1514
|
-
* "
|
|
1584
|
+
* "step": "runPHP",
|
|
1585
|
+
* "options": {
|
|
1586
|
+
* "code": "<?php echo $_SERVER['CONTENT_TYPE']; ?>",
|
|
1587
|
+
* "headers": {
|
|
1588
|
+
* "Content-type": "text/plain"
|
|
1589
|
+
* }
|
|
1590
|
+
* }
|
|
1515
1591
|
* }
|
|
1516
1592
|
* </code>
|
|
1517
1593
|
*/
|
|
1518
|
-
export interface
|
|
1519
|
-
step: "
|
|
1520
|
-
|
|
1594
|
+
export interface RunPHPWithOptionsStep {
|
|
1595
|
+
step: "runPHPWithOptions";
|
|
1596
|
+
/**
|
|
1597
|
+
* Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions)
|
|
1598
|
+
*/
|
|
1599
|
+
options: PHPRunOptions;
|
|
1521
1600
|
}
|
|
1522
1601
|
/**
|
|
1523
|
-
*
|
|
1602
|
+
* Runs PHP code with the given options.
|
|
1524
1603
|
*/
|
|
1525
|
-
export declare const
|
|
1604
|
+
export declare const runPHPWithOptions: StepHandler<RunPHPWithOptionsStep>;
|
|
1526
1605
|
/**
|
|
1527
|
-
* @inheritDoc
|
|
1606
|
+
* @inheritDoc request
|
|
1607
|
+
* @needsLogin
|
|
1528
1608
|
* @hasRunnableExample
|
|
1529
|
-
* @landingPage /wp-admin/
|
|
1530
1609
|
* @example
|
|
1531
1610
|
*
|
|
1532
1611
|
* <code>
|
|
1533
1612
|
* {
|
|
1534
|
-
* "step": "
|
|
1535
|
-
* "
|
|
1613
|
+
* "step": "request",
|
|
1614
|
+
* "request": {
|
|
1615
|
+
* "method": "POST",
|
|
1616
|
+
* "url": "/wp-admin/admin-ajax.php",
|
|
1617
|
+
* "formData": {
|
|
1618
|
+
* "action": "my_action",
|
|
1619
|
+
* "foo": "bar"
|
|
1620
|
+
* }
|
|
1621
|
+
* }
|
|
1536
1622
|
* }
|
|
1537
1623
|
* </code>
|
|
1538
1624
|
*/
|
|
1539
|
-
export interface
|
|
1540
|
-
step: "
|
|
1541
|
-
|
|
1625
|
+
export interface RequestStep {
|
|
1626
|
+
step: "request";
|
|
1627
|
+
/**
|
|
1628
|
+
* Request details (See /wordpress-playground/api/universal/interface/PHPRequest)
|
|
1629
|
+
*/
|
|
1630
|
+
request: PHPRequest;
|
|
1542
1631
|
}
|
|
1543
1632
|
/**
|
|
1544
|
-
*
|
|
1633
|
+
* Sends a HTTP request to the Playground.
|
|
1545
1634
|
*/
|
|
1546
|
-
export declare const
|
|
1635
|
+
export declare const request: StepHandler<RequestStep>;
|
|
1547
1636
|
/**
|
|
1548
1637
|
* @inheritDoc writeFile
|
|
1549
1638
|
* @hasRunnableExample
|
|
@@ -1560,7 +1649,9 @@ export declare const rmdir: StepHandler<RmdirStep>;
|
|
|
1560
1649
|
*/
|
|
1561
1650
|
export interface WriteFileStep<ResourceType> {
|
|
1562
1651
|
step: "writeFile";
|
|
1652
|
+
/** The path of the file to write to */
|
|
1563
1653
|
path: string;
|
|
1654
|
+
/** The data to write */
|
|
1564
1655
|
data: ResourceType | string | Uint8Array;
|
|
1565
1656
|
}
|
|
1566
1657
|
/**
|
|
@@ -1568,7 +1659,19 @@ export interface WriteFileStep<ResourceType> {
|
|
|
1568
1659
|
*/
|
|
1569
1660
|
export declare const writeFile: StepHandler<WriteFileStep<File>>;
|
|
1570
1661
|
/**
|
|
1571
|
-
*
|
|
1662
|
+
* @inheritDoc defineWpConfigConsts
|
|
1663
|
+
* @hasRunnableExample
|
|
1664
|
+
* @example
|
|
1665
|
+
*
|
|
1666
|
+
* <code>
|
|
1667
|
+
* {
|
|
1668
|
+
* "step": "defineWpConfigConsts",
|
|
1669
|
+
* "consts": {
|
|
1670
|
+
* "WP_DEBUG": true
|
|
1671
|
+
* },
|
|
1672
|
+
* "virtualize": true
|
|
1673
|
+
* }
|
|
1674
|
+
* </code>
|
|
1572
1675
|
*/
|
|
1573
1676
|
export interface DefineWpConfigConstsStep {
|
|
1574
1677
|
step: "defineWpConfigConsts";
|
|
@@ -1583,19 +1686,33 @@ export interface DefineWpConfigConstsStep {
|
|
|
1583
1686
|
virtualize?: boolean;
|
|
1584
1687
|
}
|
|
1585
1688
|
/**
|
|
1586
|
-
*
|
|
1689
|
+
* Defines the wp-config.php constants
|
|
1587
1690
|
*
|
|
1588
1691
|
* @param playground The playground client.
|
|
1589
|
-
* @param wpConfigConst
|
|
1590
|
-
* @returns Returns the virtual file system configuration file path.
|
|
1692
|
+
* @param wpConfigConst
|
|
1591
1693
|
*/
|
|
1592
1694
|
export declare const defineWpConfigConsts: StepHandler<DefineWpConfigConstsStep>;
|
|
1695
|
+
/**
|
|
1696
|
+
* @inheritDoc activateTheme
|
|
1697
|
+
* @example
|
|
1698
|
+
*
|
|
1699
|
+
* <code>
|
|
1700
|
+
* {
|
|
1701
|
+
* "step": "activateTheme",
|
|
1702
|
+
* "pluginName": "Storefront",
|
|
1703
|
+
* "pluginPath": "/wordpress/wp-content/themes/storefront"
|
|
1704
|
+
* }
|
|
1705
|
+
* </code>
|
|
1706
|
+
*/
|
|
1593
1707
|
export interface ActivateThemeStep {
|
|
1594
1708
|
step: "activateTheme";
|
|
1709
|
+
/**
|
|
1710
|
+
* The name of the theme folder inside wp-content/themes/
|
|
1711
|
+
*/
|
|
1595
1712
|
themeFolderName: string;
|
|
1596
1713
|
}
|
|
1597
1714
|
/**
|
|
1598
|
-
* Activates a WordPress theme
|
|
1715
|
+
* Activates a WordPress theme (if it's installed).
|
|
1599
1716
|
*
|
|
1600
1717
|
* @param playground The playground client.
|
|
1601
1718
|
* @param themeFolderName The theme folder name.
|
|
@@ -1645,25 +1762,24 @@ export interface Blueprint {
|
|
|
1645
1762
|
*/
|
|
1646
1763
|
wp: string | "latest";
|
|
1647
1764
|
};
|
|
1765
|
+
/**
|
|
1766
|
+
* The PHP extensions to use.
|
|
1767
|
+
*/
|
|
1768
|
+
phpExtensionBundles?: SupportedPHPExtensionBundle[];
|
|
1648
1769
|
/**
|
|
1649
1770
|
* The steps to run.
|
|
1650
1771
|
*/
|
|
1651
1772
|
steps?: Array<StepDefinition | string | undefined | false | null>;
|
|
1652
1773
|
}
|
|
1653
1774
|
export type CompiledStep = (php: UniversalPHP) => Promise<void> | void;
|
|
1654
|
-
declare const supportedWordPressVersions: readonly [
|
|
1655
|
-
"6.2",
|
|
1656
|
-
"6.1",
|
|
1657
|
-
"6.0",
|
|
1658
|
-
"5.9"
|
|
1659
|
-
];
|
|
1660
|
-
export type supportedWordPressVersion = (typeof supportedWordPressVersions)[number];
|
|
1661
1775
|
export interface CompiledBlueprint {
|
|
1662
1776
|
/** The requested versions of PHP and WordPress for the blueprint */
|
|
1663
1777
|
versions: {
|
|
1664
1778
|
php: SupportedPHPVersion;
|
|
1665
|
-
wp:
|
|
1779
|
+
wp: string;
|
|
1666
1780
|
};
|
|
1781
|
+
/** The requested PHP extensions to load */
|
|
1782
|
+
phpExtensions: SupportedPHPExtension[];
|
|
1667
1783
|
/** The compiled steps for the blueprint */
|
|
1668
1784
|
run: (playground: UniversalPHP) => Promise<void>;
|
|
1669
1785
|
}
|
|
@@ -1704,6 +1820,8 @@ export interface PHPWebLoaderOptions {
|
|
|
1704
1820
|
downloadMonitor?: EmscriptenDownloadMonitor;
|
|
1705
1821
|
requestHandler?: PHPRequestHandlerConfiguration;
|
|
1706
1822
|
dataModules?: Array<DataModule | Promise<DataModule>>;
|
|
1823
|
+
/** @deprecated To be replaced with `extensions` in the future */
|
|
1824
|
+
loadAllExtensions?: boolean;
|
|
1707
1825
|
}
|
|
1708
1826
|
declare class WebPHP extends BasePHP {
|
|
1709
1827
|
/**
|
|
@@ -1781,6 +1899,13 @@ declare class WebPHPEndpoint implements IsomorphicLocalPHP {
|
|
|
1781
1899
|
/** @inheritDoc @php-wasm/web!WebPHP.onMessage */
|
|
1782
1900
|
onMessage(listener: MessageListener): void;
|
|
1783
1901
|
}
|
|
1902
|
+
export type SyncProgress = {
|
|
1903
|
+
/** The number of files that have been synced. */
|
|
1904
|
+
files: number;
|
|
1905
|
+
/** The number of all files that need to be synced. */
|
|
1906
|
+
total: number;
|
|
1907
|
+
};
|
|
1908
|
+
export type SyncProgressCallback = (progress: SyncProgress) => void;
|
|
1784
1909
|
declare class PlaygroundWorkerEndpoint extends WebPHPEndpoint {
|
|
1785
1910
|
/**
|
|
1786
1911
|
* A string representing the scope of the Playground instance.
|
|
@@ -1799,10 +1924,23 @@ declare class PlaygroundWorkerEndpoint extends WebPHPEndpoint {
|
|
|
1799
1924
|
* @returns WordPress module details, including the static assets directory and default theme.
|
|
1800
1925
|
*/
|
|
1801
1926
|
getWordPressModuleDetails(): Promise<{
|
|
1927
|
+
majorVersion: string;
|
|
1802
1928
|
staticAssetsDirectory: string;
|
|
1803
|
-
defaultTheme: any;
|
|
1804
1929
|
}>;
|
|
1805
|
-
|
|
1930
|
+
getSupportedWordPressVersions(): Promise<{
|
|
1931
|
+
all: {
|
|
1932
|
+
nightly: string;
|
|
1933
|
+
beta: string;
|
|
1934
|
+
"6.3": string;
|
|
1935
|
+
"6.2": string;
|
|
1936
|
+
"6.1": string;
|
|
1937
|
+
"6.0": string;
|
|
1938
|
+
};
|
|
1939
|
+
latest: string;
|
|
1940
|
+
}>;
|
|
1941
|
+
resetVirtualOpfs(): Promise<void>;
|
|
1942
|
+
reloadFilesFromOpfs(): Promise<void>;
|
|
1943
|
+
bindOpfs(opfs: FileSystemDirectoryHandle, onProgress?: SyncProgressCallback): Promise<void>;
|
|
1806
1944
|
}
|
|
1807
1945
|
export interface ProgressBarOptions {
|
|
1808
1946
|
caption?: string;
|
|
@@ -1845,6 +1983,7 @@ export interface WebClientMixin extends ProgressReceiver {
|
|
|
1845
1983
|
onDownloadProgress: PlaygroundWorkerEndpoint["onDownloadProgress"];
|
|
1846
1984
|
/** @inheritDoc @php-wasm/universal!UniversalPHP.onMessage */
|
|
1847
1985
|
onMessage: PlaygroundWorkerEndpoint["onMessage"];
|
|
1986
|
+
bindOpfs(opfs: FileSystemDirectoryHandle, onProgress?: SyncProgressCallback): Promise<void>;
|
|
1848
1987
|
}
|
|
1849
1988
|
/**
|
|
1850
1989
|
* The Playground Client interface.
|