@wp-playground/blueprints 0.9.27 → 0.9.29
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-validator.js +1036 -877
- package/blueprint-schema.json +11 -0
- package/index.cjs +55 -48
- package/index.js +2233 -2151
- package/lib/blueprint.d.ts +7 -1
- package/lib/compile.d.ts +2 -1
- package/lib/resources.d.ts +6 -3
- package/lib/steps/activate-plugin.d.ts +5 -1
- package/lib/steps/request.d.ts +2 -1
- package/lib/steps/reset-data.d.ts +3 -5
- package/lib/steps/run-php-with-options.d.ts +2 -1
- package/lib/steps/run-php.d.ts +3 -1
- package/lib/steps/wp-cli.d.ts +4 -3
- package/lib/utils/flatten-directory.d.ts +2 -2
- package/package.json +11 -11
package/lib/blueprint.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SupportedPHPExtensionBundle, SupportedPHPVersion } from '../../../../php-wasm/universal/src/index.ts';
|
|
2
2
|
import { StepDefinition } from './steps';
|
|
3
3
|
import { FileReference } from './resources';
|
|
4
|
+
export type ExtraLibrary = 'wp-cli';
|
|
4
5
|
export interface Blueprint {
|
|
5
6
|
/**
|
|
6
7
|
* The URL to navigate to after the blueprint has been run.
|
|
@@ -31,7 +32,8 @@ export interface Blueprint {
|
|
|
31
32
|
*/
|
|
32
33
|
author: string;
|
|
33
34
|
/**
|
|
34
|
-
* Relevant categories to help users find your Blueprint in the future
|
|
35
|
+
* Relevant categories to help users find your Blueprint in the future
|
|
36
|
+
* Blueprints section on WordPress.org.
|
|
35
37
|
*/
|
|
36
38
|
categories?: string[];
|
|
37
39
|
};
|
|
@@ -54,6 +56,10 @@ export interface Blueprint {
|
|
|
54
56
|
/** Should boot with support for network request via wp_safe_remote_get? */
|
|
55
57
|
networking?: boolean;
|
|
56
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Extra libraries to preload into the Playground instance.
|
|
61
|
+
*/
|
|
62
|
+
extraLibraries?: ExtraLibrary[];
|
|
57
63
|
/**
|
|
58
64
|
* PHP Constants to define on every request
|
|
59
65
|
*/
|
package/lib/compile.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ProgressTracker } from '../../../../php-wasm/progress/src/index.ts';
|
|
|
2
2
|
import { Semaphore } from '../../../../php-wasm/util/src/index.ts';
|
|
3
3
|
import { SupportedPHPExtension, SupportedPHPVersion, UniversalPHP } from '../../../../php-wasm/universal/src/index.ts';
|
|
4
4
|
import { StepDefinition } from './steps';
|
|
5
|
-
import { Blueprint } from './blueprint';
|
|
5
|
+
import { Blueprint, ExtraLibrary } from './blueprint';
|
|
6
6
|
export type CompiledStep = (php: UniversalPHP) => Promise<void> | void;
|
|
7
7
|
export interface CompiledBlueprint {
|
|
8
8
|
/** The requested versions of PHP and WordPress for the blueprint */
|
|
@@ -16,6 +16,7 @@ export interface CompiledBlueprint {
|
|
|
16
16
|
/** Should boot with support for network request via wp_safe_remote_get? */
|
|
17
17
|
networking: boolean;
|
|
18
18
|
};
|
|
19
|
+
extraLibraries: ExtraLibrary[];
|
|
19
20
|
/** The compiled steps for the blueprint */
|
|
20
21
|
run: (playground: UniversalPHP) => Promise<void>;
|
|
21
22
|
}
|
package/lib/resources.d.ts
CHANGED
|
@@ -69,7 +69,8 @@ export declare abstract class Resource {
|
|
|
69
69
|
get isAsync(): boolean;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
|
-
* A `Resource` that represents a file in the VFS (virtual file system) of the
|
|
72
|
+
* A `Resource` that represents a file in the VFS (virtual file system) of the
|
|
73
|
+
* playground.
|
|
73
74
|
*/
|
|
74
75
|
export declare class VFSResource extends Resource {
|
|
75
76
|
private resource;
|
|
@@ -173,7 +174,8 @@ export declare class CorePluginResource extends FetchResource {
|
|
|
173
174
|
*/
|
|
174
175
|
export declare function toDirectoryZipName(rawInput: string): string;
|
|
175
176
|
/**
|
|
176
|
-
* A decorator for a resource that adds functionality such as progress tracking
|
|
177
|
+
* A decorator for a resource that adds functionality such as progress tracking
|
|
178
|
+
* and caching.
|
|
177
179
|
*/
|
|
178
180
|
export declare class DecoratedResource<T extends Resource> extends Resource {
|
|
179
181
|
private resource;
|
|
@@ -200,7 +202,8 @@ export declare class CachedResource<T extends Resource> extends DecoratedResourc
|
|
|
200
202
|
resolve(): Promise<File>;
|
|
201
203
|
}
|
|
202
204
|
/**
|
|
203
|
-
* A decorator for a resource that adds concurrency control functionality
|
|
205
|
+
* A decorator for a resource that adds concurrency control functionality
|
|
206
|
+
* through a semaphore.
|
|
204
207
|
*/
|
|
205
208
|
export declare class SemaphoreResource<T extends Resource> extends DecoratedResource<T> {
|
|
206
209
|
private readonly semaphore;
|
|
@@ -13,7 +13,11 @@ import { StepHandler } from '.';
|
|
|
13
13
|
*/
|
|
14
14
|
export interface ActivatePluginStep {
|
|
15
15
|
step: 'activatePlugin';
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Path to the plugin directory as absolute path
|
|
18
|
+
* (/wordpress/wp-content/plugins/plugin-name); or the plugin entry file
|
|
19
|
+
* relative to the plugins directory (plugin-name/plugin-name.php).
|
|
20
|
+
*/
|
|
17
21
|
pluginPath: string;
|
|
18
22
|
/** Optional. Plugin name to display in the progress bar. */
|
|
19
23
|
pluginName?: string;
|
package/lib/steps/request.d.ts
CHANGED
|
@@ -24,7 +24,8 @@ import { StepHandler } from '.';
|
|
|
24
24
|
export interface RequestStep {
|
|
25
25
|
step: 'request';
|
|
26
26
|
/**
|
|
27
|
-
* Request details (See
|
|
27
|
+
* Request details (See
|
|
28
|
+
* /wordpress-playground/api/universal/interface/PHPRequest)
|
|
28
29
|
*/
|
|
29
30
|
request: PHPRequest;
|
|
30
31
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { StepHandler } from '.';
|
|
2
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
3
|
* @inheritDoc resetData
|
|
9
4
|
* @example
|
|
10
5
|
*
|
|
@@ -18,6 +13,9 @@ export interface ResetDataStep {
|
|
|
18
13
|
step: 'resetData';
|
|
19
14
|
}
|
|
20
15
|
/**
|
|
16
|
+
* Deletes WordPress posts and comments and sets the auto increment sequence
|
|
17
|
+
* for the posts and comments tables to 0.
|
|
18
|
+
*
|
|
21
19
|
* @param playground Playground client.
|
|
22
20
|
*/
|
|
23
21
|
export declare const resetData: StepHandler<ResetDataStep>;
|
|
@@ -20,7 +20,8 @@ import { PHPRunOptions } from '../../../../../php-wasm/universal/src/index.ts';
|
|
|
20
20
|
export interface RunPHPWithOptionsStep {
|
|
21
21
|
step: 'runPHPWithOptions';
|
|
22
22
|
/**
|
|
23
|
-
* Run options (See
|
|
23
|
+
* Run options (See
|
|
24
|
+
* /wordpress-playground/api/universal/interface/PHPRunOptions/))
|
|
24
25
|
*/
|
|
25
26
|
options: PHPRunOptions;
|
|
26
27
|
}
|
package/lib/steps/run-php.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ import { StepHandler } from '.';
|
|
|
8
8
|
* <code>
|
|
9
9
|
* {
|
|
10
10
|
* "step": "runPHP",
|
|
11
|
-
* "code": "<?php require_once 'wordpress/wp-load.php';
|
|
11
|
+
* "code": "<?php require_once 'wordpress/wp-load.php';
|
|
12
|
+
* wp_insert_post(array('post_title' => 'wp-load.php required for WP
|
|
13
|
+
* functionality', 'post_status' => 'publish')); ?>"
|
|
12
14
|
* }
|
|
13
15
|
* </code>
|
|
14
16
|
*/
|
package/lib/steps/wp-cli.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ import { StepHandler } from '.';
|
|
|
8
8
|
* <code>
|
|
9
9
|
* {
|
|
10
10
|
* "step": "wp-cli",
|
|
11
|
-
* "command": "wp post create --post_title='Test post' --post_excerpt='Some
|
|
11
|
+
* "command": "wp post create --post_title='Test post' --post_excerpt='Some
|
|
12
|
+
* content'"
|
|
12
13
|
* }
|
|
13
14
|
* </code>
|
|
14
15
|
*/
|
|
@@ -26,8 +27,8 @@ export interface WPCLIStep {
|
|
|
26
27
|
export declare const wpCLI: StepHandler<WPCLIStep, Promise<PHPResponse>>;
|
|
27
28
|
/**
|
|
28
29
|
* Naive shell command parser.
|
|
29
|
-
* Ensures that commands like `wp option set blogname "My blog name"` are split
|
|
30
|
-
* `['wp', 'option', 'set', 'blogname', 'My blog name']` instead of
|
|
30
|
+
* Ensures that commands like `wp option set blogname "My blog name"` are split
|
|
31
|
+
* into `['wp', 'option', 'set', 'blogname', 'My blog name']` instead of
|
|
31
32
|
* `['wp', 'option', 'set', 'blogname', 'My', 'blog', 'name']`.
|
|
32
33
|
*
|
|
33
34
|
* @param command
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { UniversalPHP } from '../../../../../php-wasm/universal/src/index.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Flattens a directory.
|
|
4
|
-
* If the directory contains only one file, it will be moved to the parent
|
|
5
|
-
* Otherwise, the directory will be renamed to the default name.
|
|
4
|
+
* If the directory contains only one file, it will be moved to the parent
|
|
5
|
+
* directory. Otherwise, the directory will be renamed to the default name.
|
|
6
6
|
*
|
|
7
7
|
* @param php Playground client.
|
|
8
8
|
* @param directoryPath The directory to flatten.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/blueprints",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.29",
|
|
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": "
|
|
24
|
+
"gitHead": "79ef61d98407b1a90f622f6bef8f91001c568d00",
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": ">=18.18.0",
|
|
27
27
|
"npm": ">=8.11.0"
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"ajv": "8.12.0",
|
|
31
31
|
"comlink": "^4.4.1",
|
|
32
32
|
"ini": "4.1.2",
|
|
33
|
-
"@php-wasm/node-polyfills": "0.9.
|
|
34
|
-
"@php-wasm/universal": "0.9.
|
|
35
|
-
"@wp-playground/common": "0.9.
|
|
36
|
-
"@php-wasm/node": "0.9.
|
|
37
|
-
"@php-wasm/progress": "0.9.
|
|
38
|
-
"@php-wasm/util": "0.9.
|
|
39
|
-
"@php-wasm/logger": "0.9.
|
|
40
|
-
"@wp-playground/wordpress": "0.9.
|
|
41
|
-
"@php-wasm/scopes": "0.9.
|
|
33
|
+
"@php-wasm/node-polyfills": "0.9.29",
|
|
34
|
+
"@php-wasm/universal": "0.9.29",
|
|
35
|
+
"@wp-playground/common": "0.9.29",
|
|
36
|
+
"@php-wasm/node": "0.9.29",
|
|
37
|
+
"@php-wasm/progress": "0.9.29",
|
|
38
|
+
"@php-wasm/util": "0.9.29",
|
|
39
|
+
"@php-wasm/logger": "0.9.29",
|
|
40
|
+
"@wp-playground/wordpress": "0.9.29",
|
|
41
|
+
"@php-wasm/scopes": "0.9.29"
|
|
42
42
|
}
|
|
43
43
|
}
|