@wp-playground/blueprints 0.7.18 → 0.7.20
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/blueprint-schema.json +2 -2
- package/index.cjs +123 -102
- package/index.d.ts +19 -30
- package/index.js +1118 -1067
- package/lib/steps/define-site-url.d.ts +3 -3
- package/lib/steps/define-wp-config-consts.d.ts +3 -2
- package/lib/steps/enable-multisite.d.ts +1 -1
- package/lib/steps/import-wordpress-files.d.ts +2 -2
- package/lib/steps/login.d.ts +2 -2
- package/lib/steps/request.d.ts +1 -1
- package/lib/steps/run-php-with-options.d.ts +1 -1
- package/lib/steps/run-php.d.ts +1 -0
- package/lib/steps/site-data.d.ts +3 -3
- package/lib/steps/wp-cli.d.ts +1 -1
- package/package.json +2 -2
- package/lib/utils/run-php-with-zip-functions.d.ts +0 -2
package/index.d.ts
CHANGED
|
@@ -252,19 +252,6 @@ export interface IsomorphicLocalPHP {
|
|
|
252
252
|
* @param listener - The listener function to be removed.
|
|
253
253
|
*/
|
|
254
254
|
removeEventListener(eventType: PHPEvent["type"], listener: PHPEventListener): void;
|
|
255
|
-
/**
|
|
256
|
-
* Sets the path to the php.ini file to use for the PHP instance.
|
|
257
|
-
*
|
|
258
|
-
* @param path - The path to the php.ini file.
|
|
259
|
-
*/
|
|
260
|
-
setPhpIniPath(path: string): void;
|
|
261
|
-
/**
|
|
262
|
-
* Sets a value for a specific key in the php.ini file for the PHP instance.
|
|
263
|
-
*
|
|
264
|
-
* @param key - The key to set the value for.
|
|
265
|
-
* @param value - The value to set for the key.
|
|
266
|
-
*/
|
|
267
|
-
setPhpIniEntry(key: string, value: string): void;
|
|
268
255
|
/**
|
|
269
256
|
* Recursively creates a directory with the given path in the PHP filesystem.
|
|
270
257
|
* For example, if the path is `/root/php/data`, and `/root` already exists,
|
|
@@ -472,7 +459,7 @@ export type MessageListener = (data: string) => Promise<string | Uint8Array | vo
|
|
|
472
459
|
* that can't be serialized over a remote connection. Therefeore,
|
|
473
460
|
* they don't make sense in a remote PHP instance.
|
|
474
461
|
*/
|
|
475
|
-
export type IsomorphicRemotePHP = Remote<Omit<IsomorphicLocalPHP, "setSapiName"
|
|
462
|
+
export type IsomorphicRemotePHP = Remote<Omit<IsomorphicLocalPHP, "setSapiName">>;
|
|
476
463
|
export type UniversalPHP = IsomorphicLocalPHP | IsomorphicRemotePHP;
|
|
477
464
|
export type HTTPMethod = "GET" | "POST" | "HEAD" | "OPTIONS" | "PATCH" | "PUT" | "DELETE";
|
|
478
465
|
export type PHPRequestHeaders = Record<string, string>;
|
|
@@ -825,10 +812,10 @@ export interface DefineSiteUrlStep {
|
|
|
825
812
|
siteUrl: string;
|
|
826
813
|
}
|
|
827
814
|
/**
|
|
828
|
-
* Sets WP_HOME and WP_SITEURL constants for the WordPress installation.
|
|
815
|
+
* Sets [`WP_HOME`](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#blog-address-url) and [`WP_SITEURL`](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#wp-siteurl) constants for the WordPress installation.
|
|
829
816
|
*
|
|
830
|
-
*
|
|
831
|
-
* It is useful when
|
|
817
|
+
* Using this step on playground.wordpress.net is moot.
|
|
818
|
+
* It is useful when building a custom Playground-based tool, like [`wp-now`](https://www.npmjs.com/package/@wp-now/wp-now),
|
|
832
819
|
* or deploying Playground on a custom domain.
|
|
833
820
|
*
|
|
834
821
|
* @param playground The playground client.
|
|
@@ -979,8 +966,8 @@ export type LoginStep = {
|
|
|
979
966
|
password?: string;
|
|
980
967
|
};
|
|
981
968
|
/**
|
|
982
|
-
* Logs in to
|
|
983
|
-
* Under the hood, this function submits the wp-login.php form
|
|
969
|
+
* Logs in to Playground.
|
|
970
|
+
* Under the hood, this function submits the [`wp-login.php`](https://developer.wordpress.org/reference/files/wp-login.php/) [form](https://developer.wordpress.org/reference/functions/wp_login_form/)
|
|
984
971
|
* just like a user would.
|
|
985
972
|
*/
|
|
986
973
|
export declare const login: StepHandler<LoginStep>;
|
|
@@ -1025,8 +1012,8 @@ export type SetSiteOptionsStep = {
|
|
|
1025
1012
|
options: Record<string, unknown>;
|
|
1026
1013
|
};
|
|
1027
1014
|
/**
|
|
1028
|
-
* Sets site options. This is equivalent to calling `update_option` for each
|
|
1029
|
-
* option in the `options` object.
|
|
1015
|
+
* Sets site options. This is equivalent to calling [`update_option`](https://developer.wordpress.org/reference/functions/update_option/) for each
|
|
1016
|
+
* option in the [`options`](https://developer.wordpress.org/apis/options/#available-options-by-category) object.
|
|
1030
1017
|
*/
|
|
1031
1018
|
export declare const setSiteOptions: StepHandler<SetSiteOptionsStep>;
|
|
1032
1019
|
/**
|
|
@@ -1054,7 +1041,7 @@ export interface UpdateUserMetaStep {
|
|
|
1054
1041
|
userId: number;
|
|
1055
1042
|
}
|
|
1056
1043
|
/**
|
|
1057
|
-
* Updates user meta. This is equivalent to calling `update_user_meta` for each
|
|
1044
|
+
* Updates user meta. This is equivalent to calling [`update_user_meta`](https://developer.wordpress.org/reference/functions/update_user_meta/) for each
|
|
1058
1045
|
* meta value in the `meta` object.
|
|
1059
1046
|
*/
|
|
1060
1047
|
export declare const updateUserMeta: StepHandler<UpdateUserMetaStep>;
|
|
@@ -1227,6 +1214,7 @@ export interface RunPHPStep {
|
|
|
1227
1214
|
}
|
|
1228
1215
|
/**
|
|
1229
1216
|
* Runs PHP code.
|
|
1217
|
+
* When running WordPress functions, the `code` key must first load [`wp-load.php`](https://github.com/WordPress/WordPress/blob/master/wp-load.php) and start with `"<?php require_once 'wordpress/wp-load.php'; "`.
|
|
1230
1218
|
*/
|
|
1231
1219
|
export declare const runPHP: StepHandler<RunPHPStep, Promise<PHPResponse>>;
|
|
1232
1220
|
/**
|
|
@@ -1249,7 +1237,7 @@ export declare const runPHP: StepHandler<RunPHPStep, Promise<PHPResponse>>;
|
|
|
1249
1237
|
export interface RunPHPWithOptionsStep {
|
|
1250
1238
|
step: "runPHPWithOptions";
|
|
1251
1239
|
/**
|
|
1252
|
-
* Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions)
|
|
1240
|
+
* Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions/))
|
|
1253
1241
|
*/
|
|
1254
1242
|
options: PHPRunOptions;
|
|
1255
1243
|
}
|
|
@@ -1286,7 +1274,7 @@ export interface RequestStep {
|
|
|
1286
1274
|
request: PHPRequest;
|
|
1287
1275
|
}
|
|
1288
1276
|
/**
|
|
1289
|
-
* Sends a HTTP request to
|
|
1277
|
+
* Sends a HTTP request to Playground.
|
|
1290
1278
|
*/
|
|
1291
1279
|
export declare const request: StepHandler<RequestStep, Promise<PHPResponse>>;
|
|
1292
1280
|
/**
|
|
@@ -1333,13 +1321,14 @@ export interface DefineWpConfigConstsStep {
|
|
|
1333
1321
|
/** The constants to define */
|
|
1334
1322
|
consts: Record<string, unknown>;
|
|
1335
1323
|
/**
|
|
1336
|
-
* The method of defining the constants. Possible values are:
|
|
1324
|
+
* The method of defining the constants in wp-config.php. Possible values are:
|
|
1337
1325
|
*
|
|
1338
1326
|
* - rewrite-wp-config: Default. Rewrites the wp-config.php file to
|
|
1339
1327
|
* explicitly call define() with the requested
|
|
1340
1328
|
* name and value. This method alters the file
|
|
1341
1329
|
* on the disk, but it doesn't conflict with
|
|
1342
1330
|
* existing define() calls in wp-config.php.
|
|
1331
|
+
*
|
|
1343
1332
|
* - define-before-run: Defines the constant before running the requested
|
|
1344
1333
|
* script. It doesn't alter any files on the disk, but
|
|
1345
1334
|
* constants defined this way may conflict with existing
|
|
@@ -1354,7 +1343,7 @@ export interface DefineWpConfigConstsStep {
|
|
|
1354
1343
|
virtualize?: boolean;
|
|
1355
1344
|
}
|
|
1356
1345
|
/**
|
|
1357
|
-
* Defines constants in a wp-config.php file.
|
|
1346
|
+
* Defines constants in a [`wp-config.php`](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/) file.
|
|
1358
1347
|
*
|
|
1359
1348
|
* This step can be called multiple times, and the constants will be merged.
|
|
1360
1349
|
*
|
|
@@ -1450,9 +1439,9 @@ export interface ImportWordPressFilesStep<ResourceType> {
|
|
|
1450
1439
|
}
|
|
1451
1440
|
/**
|
|
1452
1441
|
* Imports top-level WordPress files from a given zip file into
|
|
1453
|
-
* the documentRoot
|
|
1442
|
+
* the `documentRoot`. For example, if a zip file contains the
|
|
1454
1443
|
* `wp-content` and `wp-includes` directories, they will replace
|
|
1455
|
-
* the corresponding directories in Playground's documentRoot
|
|
1444
|
+
* the corresponding directories in Playground's `documentRoot`.
|
|
1456
1445
|
*
|
|
1457
1446
|
* Any files that Playground recognizes as "excluded from the export"
|
|
1458
1447
|
* will carry over from the existing document root into the imported
|
|
@@ -1503,7 +1492,7 @@ export interface EnableMultisiteStep {
|
|
|
1503
1492
|
step: "enableMultisite";
|
|
1504
1493
|
}
|
|
1505
1494
|
/**
|
|
1506
|
-
* Defines constants in a wp-config.php file.
|
|
1495
|
+
* Defines the [Multisite](https://developer.wordpress.org/advanced-administration/multisite/create-network/) constants in a `wp-config.php` file.
|
|
1507
1496
|
*
|
|
1508
1497
|
* This step can be called multiple times, and the constants will be merged.
|
|
1509
1498
|
*
|
|
@@ -1532,7 +1521,7 @@ export interface WPCLIStep {
|
|
|
1532
1521
|
wpCliPath?: string;
|
|
1533
1522
|
}
|
|
1534
1523
|
/**
|
|
1535
|
-
* Runs PHP code.
|
|
1524
|
+
* Runs PHP code using [WP-CLI](https://developer.wordpress.org/cli/commands/).
|
|
1536
1525
|
*/
|
|
1537
1526
|
export declare const wpCLI: StepHandler<WPCLIStep, Promise<PHPResponse>>;
|
|
1538
1527
|
/**
|