@wp-playground/blueprints 0.7.19 → 0.9.1

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.
@@ -10,10 +10,10 @@ export interface DefineSiteUrlStep {
10
10
  siteUrl: string;
11
11
  }
12
12
  /**
13
- * Sets WP_HOME and WP_SITEURL constants for the WordPress installation.
13
+ * 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.
14
14
  *
15
- * Beware: Using this step makes no sense on playground.wordpress.net.
16
- * It is useful when you're building a custom Playground-based tool like wp-now,
15
+ * Using this step on playground.wordpress.net is moot.
16
+ * It is useful when building a custom Playground-based tool, like [`wp-now`](https://www.npmjs.com/package/@wp-now/wp-now),
17
17
  * or deploying Playground on a custom domain.
18
18
  *
19
19
  * @param playground The playground client.
@@ -19,13 +19,14 @@ export interface DefineWpConfigConstsStep {
19
19
  /** The constants to define */
20
20
  consts: Record<string, unknown>;
21
21
  /**
22
- * The method of defining the constants. Possible values are:
22
+ * The method of defining the constants in wp-config.php. Possible values are:
23
23
  *
24
24
  * - rewrite-wp-config: Default. Rewrites the wp-config.php file to
25
25
  * explicitly call define() with the requested
26
26
  * name and value. This method alters the file
27
27
  * on the disk, but it doesn't conflict with
28
28
  * existing define() calls in wp-config.php.
29
+ *
29
30
  * - define-before-run: Defines the constant before running the requested
30
31
  * script. It doesn't alter any files on the disk, but
31
32
  * constants defined this way may conflict with existing
@@ -40,7 +41,7 @@ export interface DefineWpConfigConstsStep {
40
41
  virtualize?: boolean;
41
42
  }
42
43
  /**
43
- * Defines constants in a wp-config.php file.
44
+ * Defines constants in a [`wp-config.php`](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/) file.
44
45
  *
45
46
  * This step can be called multiple times, and the constants will be merged.
46
47
  *
@@ -14,7 +14,7 @@ export interface EnableMultisiteStep {
14
14
  step: 'enableMultisite';
15
15
  }
16
16
  /**
17
- * Defines constants in a wp-config.php file.
17
+ * Defines the [Multisite](https://developer.wordpress.org/advanced-administration/multisite/create-network/) constants in a `wp-config.php` file.
18
18
  *
19
19
  * This step can be called multiple times, and the constants will be merged.
20
20
  *
@@ -19,6 +19,7 @@ export { unzip } from './unzip';
19
19
  export { installPlugin } from './install-plugin';
20
20
  export { installTheme } from './install-theme';
21
21
  export { login } from './login';
22
+ export { resetData } from './reset-data';
22
23
  export { runWpInstallationWizard } from './run-wp-installation-wizard';
23
24
  export { setSiteOptions, updateUserMeta } from './site-data';
24
25
  export { defineWpConfigConsts } from './define-wp-config-consts';
@@ -27,9 +27,9 @@ export interface ImportWordPressFilesStep<ResourceType> {
27
27
  }
28
28
  /**
29
29
  * Imports top-level WordPress files from a given zip file into
30
- * the documentRoot. For example, if a zip file contains the
30
+ * the `documentRoot`. For example, if a zip file contains the
31
31
  * `wp-content` and `wp-includes` directories, they will replace
32
- * the corresponding directories in Playground's documentRoot.
32
+ * the corresponding directories in Playground's `documentRoot`.
33
33
  *
34
34
  * Any files that Playground recognizes as "excluded from the export"
35
35
  * will carry over from the existing document root into the imported
@@ -25,6 +25,7 @@ import { ImportWordPressFilesStep } from './import-wordpress-files';
25
25
  import { ImportWxrStep } from './import-wxr';
26
26
  import { EnableMultisiteStep } from './enable-multisite';
27
27
  import { WPCLIStep } from './wp-cli';
28
+ import { ResetDataStep } from './reset-data';
28
29
  export type Step = GenericStep<FileReference>;
29
30
  export type StepDefinition = Step & {
30
31
  progress?: {
@@ -37,8 +38,8 @@ export { wpContentFilesExcludedFromExport } from '../utils/wp-content-files-excl
37
38
  * If you add a step here, make sure to also
38
39
  * add it to the exports below.
39
40
  */
40
- export type GenericStep<Resource> = ActivatePluginStep | ActivateThemeStep | CpStep | DefineWpConfigConstsStep | DefineSiteUrlStep | EnableMultisiteStep | ImportWxrStep<Resource> | ImportWordPressFilesStep<Resource> | InstallPluginStep<Resource> | InstallThemeStep<Resource> | LoginStep | MkdirStep | MvStep | RequestStep | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | RunSqlStep<Resource> | SetSiteOptionsStep | UnzipStep<Resource> | UpdateUserMetaStep | WriteFileStep<Resource> | WPCLIStep;
41
- export type { ActivatePluginStep, ActivateThemeStep, CpStep, DefineWpConfigConstsStep, DefineSiteUrlStep, EnableMultisiteStep, ImportWxrStep, ImportWordPressFilesStep, InstallPluginStep, InstallPluginOptions, InstallThemeStep, InstallThemeOptions, LoginStep, MkdirStep, MvStep, RequestStep, RmStep, RmdirStep, RunPHPStep, RunPHPWithOptionsStep, RunWpInstallationWizardStep, RunSqlStep, WordPressInstallationOptions, SetSiteOptionsStep, UnzipStep, UpdateUserMetaStep, WriteFileStep, WPCLIStep, };
41
+ export type GenericStep<Resource> = ActivatePluginStep | ActivateThemeStep | CpStep | DefineWpConfigConstsStep | DefineSiteUrlStep | EnableMultisiteStep | ImportWxrStep<Resource> | ImportWordPressFilesStep<Resource> | InstallPluginStep<Resource> | InstallThemeStep<Resource> | LoginStep | MkdirStep | MvStep | ResetDataStep | RequestStep | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | RunSqlStep<Resource> | SetSiteOptionsStep | UnzipStep<Resource> | UpdateUserMetaStep | WriteFileStep<Resource> | WPCLIStep;
42
+ export type { ActivatePluginStep, ActivateThemeStep, CpStep, DefineWpConfigConstsStep, DefineSiteUrlStep, EnableMultisiteStep, ImportWxrStep, ImportWordPressFilesStep, InstallPluginStep, InstallPluginOptions, InstallThemeStep, InstallThemeOptions, LoginStep, MkdirStep, MvStep, ResetDataStep, RequestStep, RmStep, RmdirStep, RunPHPStep, RunPHPWithOptionsStep, RunWpInstallationWizardStep, RunSqlStep, WordPressInstallationOptions, SetSiteOptionsStep, UnzipStep, UpdateUserMetaStep, WriteFileStep, WPCLIStep, };
42
43
  /**
43
44
  * Progress reporting details.
44
45
  */
@@ -24,8 +24,8 @@ export type LoginStep = {
24
24
  password?: string;
25
25
  };
26
26
  /**
27
- * Logs in to the Playground.
28
- * Under the hood, this function submits the wp-login.php form
27
+ * Logs in to Playground.
28
+ * 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/)
29
29
  * just like a user would.
30
30
  */
31
31
  export declare const login: StepHandler<LoginStep>;
@@ -29,6 +29,6 @@ export interface RequestStep {
29
29
  request: PHPRequest;
30
30
  }
31
31
  /**
32
- * Sends a HTTP request to the Playground.
32
+ * Sends a HTTP request to Playground.
33
33
  */
34
34
  export declare const request: StepHandler<RequestStep, Promise<PHPResponse>>;
@@ -0,0 +1,23 @@
1
+ import { StepHandler } from '.';
2
+ /**
3
+ * Deletes WordPress posts and comments and sets the auto increment sequence for the
4
+ * posts and comments tables to 0.
5
+ *
6
+ * @private
7
+ * @internal
8
+ * @inheritDoc resetData
9
+ * @example
10
+ *
11
+ * <code>
12
+ * {
13
+ * "step": "resetData"
14
+ * }
15
+ * </code>
16
+ */
17
+ export interface ResetDataStep {
18
+ step: 'resetData';
19
+ }
20
+ /**
21
+ * @param playground Playground client.
22
+ */
23
+ export declare const resetData: StepHandler<ResetDataStep>;
@@ -20,7 +20,7 @@ import { PHPRunOptions } from '../../../../../php-wasm/universal/src/index.ts';
20
20
  export interface RunPHPWithOptionsStep {
21
21
  step: 'runPHPWithOptions';
22
22
  /**
23
- * Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions)
23
+ * Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions/))
24
24
  */
25
25
  options: PHPRunOptions;
26
26
  }
@@ -20,5 +20,6 @@ export interface RunPHPStep {
20
20
  }
21
21
  /**
22
22
  * Runs PHP code.
23
+ * 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'; "`.
23
24
  */
24
25
  export declare const runPHP: StepHandler<RunPHPStep, Promise<PHPResponse>>;
@@ -22,8 +22,8 @@ export type SetSiteOptionsStep = {
22
22
  options: Record<string, unknown>;
23
23
  };
24
24
  /**
25
- * Sets site options. This is equivalent to calling `update_option` for each
26
- * option in the `options` object.
25
+ * Sets site options. This is equivalent to calling [`update_option`](https://developer.wordpress.org/reference/functions/update_option/) for each
26
+ * option in the [`options`](https://developer.wordpress.org/apis/options/#available-options-by-category) object.
27
27
  */
28
28
  export declare const setSiteOptions: StepHandler<SetSiteOptionsStep>;
29
29
  /**
@@ -51,7 +51,7 @@ export interface UpdateUserMetaStep {
51
51
  userId: number;
52
52
  }
53
53
  /**
54
- * Updates user meta. This is equivalent to calling `update_user_meta` for each
54
+ * Updates user meta. This is equivalent to calling [`update_user_meta`](https://developer.wordpress.org/reference/functions/update_user_meta/) for each
55
55
  * meta value in the `meta` object.
56
56
  */
57
57
  export declare const updateUserMeta: StepHandler<UpdateUserMetaStep>;
@@ -21,7 +21,7 @@ export interface WPCLIStep {
21
21
  wpCliPath?: string;
22
22
  }
23
23
  /**
24
- * Runs PHP code.
24
+ * Runs PHP code using [WP-CLI](https://developer.wordpress.org/cli/commands/).
25
25
  */
26
26
  export declare const wpCLI: StepHandler<WPCLIStep, Promise<PHPResponse>>;
27
27
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-playground/blueprints",
3
- "version": "0.7.19",
3
+ "version": "0.9.1",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./index.js",
@@ -21,7 +21,7 @@
21
21
  "access": "public",
22
22
  "directory": "../../../dist/packages/playground/blueprints"
23
23
  },
24
- "gitHead": "687ec237085853ff5c808814c28be349146a5d1a",
24
+ "gitHead": "1097764159c71f5fd9f215f46385d1c83428fe01",
25
25
  "engines": {
26
26
  "node": ">=18.18.0",
27
27
  "npm": ">=8.11.0"
@@ -1,2 +0,0 @@
1
- import { UniversalPHP } from '../../../../../php-wasm/universal/src/index.ts';
2
- export declare function runPhpWithZipFunctions(playground: UniversalPHP, code: string): Promise<import('../../../../../php-wasm/universal/src/index.ts').PHPResponse>;