@wp-playground/blueprints 3.0.22 → 3.0.31
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 +1971 -1688
- package/blueprint-schema.json +121 -80
- package/blueprints-Gs5fAvvo.cjs +2 -0
- package/blueprints-Gs5fAvvo.cjs.map +1 -0
- package/blueprints-pMn3V9MZ.js +5 -0
- package/blueprints-pMn3V9MZ.js.map +1 -0
- package/index.cjs +349 -100
- package/index.cjs.map +1 -1
- package/index.d.ts +4 -3
- package/index.js +3708 -3052
- package/index.js.map +1 -1
- package/lib/reflection.d.ts +1 -1
- package/lib/resolve-remote-blueprint.d.ts +4 -0
- package/lib/steps/run-php-with-options.d.ts +3 -5
- package/lib/steps/run-sql.d.ts +5 -3
- package/lib/types.d.ts +2 -2
- package/lib/v1/compile.d.ts +39 -4
- package/lib/v1/resources.d.ts +66 -3
- package/lib/v1/types.d.ts +1 -0
- package/package.json +21 -15
- package/blueprints-DY7omvFh.cjs +0 -2
- package/blueprints-DY7omvFh.cjs.map +0 -1
- package/blueprints-Dg6flSLH.js +0 -5
- package/blueprints-Dg6flSLH.js.map +0 -1
package/lib/reflection.d.ts
CHANGED
|
@@ -14,6 +14,6 @@ export declare class BlueprintReflection {
|
|
|
14
14
|
getVersion(): number;
|
|
15
15
|
getDeclaration(): import("./v2/wep-1-blueprint-v2-schema/appendix-A-blueprint-v2-schema").V2Schema.BlueprintV2 | BlueprintV1Declaration;
|
|
16
16
|
isBundle(): boolean;
|
|
17
|
-
getBundle(): import("@wp-playground/storage").
|
|
17
|
+
getBundle(): import("@wp-playground/storage").ReadableFilesystemBackend | undefined;
|
|
18
18
|
getBlueprint(): Blueprint;
|
|
19
19
|
}
|
|
@@ -7,12 +7,10 @@ import type { PHPRunOptions } from '@php-wasm/universal';
|
|
|
7
7
|
*
|
|
8
8
|
* <code>
|
|
9
9
|
* {
|
|
10
|
-
* "step": "
|
|
10
|
+
* "step": "runPHPWithOptions",
|
|
11
11
|
* "options": {
|
|
12
|
-
* "code": "<?php
|
|
13
|
-
* "
|
|
14
|
-
* "Content-type": "text/plain"
|
|
15
|
-
* }
|
|
12
|
+
* "code": "<?php require_once '/wordpress/wp-load.php'; update_option('blogname', file_get_contents('php://input'));?>",
|
|
13
|
+
* "body": "Site Name Modified by runPHPWithOptions"
|
|
16
14
|
* }
|
|
17
15
|
* }
|
|
18
16
|
* </code>
|
package/lib/steps/run-sql.d.ts
CHANGED
|
@@ -28,8 +28,10 @@ export interface RunSqlStep<ResourceType> {
|
|
|
28
28
|
/**
|
|
29
29
|
* Run one or more SQL queries.
|
|
30
30
|
*
|
|
31
|
-
* This step
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* This step uses WP_MySQL_Naive_Query_Stream to parse and execute SQL queries using
|
|
32
|
+
* streaming semantics. It supports multiline queries, comments, and queries
|
|
33
|
+
* separated by semicolons. Each query is executed using `$wpdb`. This step assumes
|
|
34
|
+
* a presence of the `sqlite-database-integration` plugin that ships the required
|
|
35
|
+
* query tokenizer classes.
|
|
34
36
|
*/
|
|
35
37
|
export declare const runSql: StepHandler<RunSqlStep<File>>;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReadableFilesystemBackend } from '@wp-playground/storage';
|
|
2
2
|
import type { BlueprintV1, BlueprintV1Declaration, ExtraLibrary, PHPConstants } from './v1/types';
|
|
3
3
|
import type { BlueprintV2, BlueprintV2Declaration } from './v2/blueprint-v2-declaration';
|
|
4
4
|
import type { SupportedPHPVersion } from '@php-wasm/universal';
|
|
@@ -6,7 +6,7 @@ import type { SupportedPHPVersion } from '@php-wasm/universal';
|
|
|
6
6
|
* A filesystem structure containing a /blueprint.json file and any
|
|
7
7
|
* resources referenced by that blueprint.
|
|
8
8
|
*/
|
|
9
|
-
export type BlueprintBundle =
|
|
9
|
+
export type BlueprintBundle = ReadableFilesystemBackend;
|
|
10
10
|
export type BlueprintDeclaration = BlueprintV1Declaration | BlueprintV2Declaration;
|
|
11
11
|
export type Blueprint = BlueprintV1 | BlueprintV2;
|
|
12
12
|
export interface RuntimeConfiguration {
|
package/lib/v1/compile.d.ts
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
import { ProgressTracker } from '@php-wasm/progress';
|
|
2
2
|
import { Semaphore } from '@php-wasm/util';
|
|
3
3
|
import type { SupportedPHPVersion, UniversalPHP } from '@php-wasm/universal';
|
|
4
|
-
import type { StepDefinition } from '../steps';
|
|
4
|
+
import type { Step, StepDefinition } from '../steps';
|
|
5
5
|
import type { BlueprintV1Declaration, ExtraLibrary, StreamBundledFile, BlueprintV1 } from './types';
|
|
6
6
|
import type { BlueprintBundle } from '../types';
|
|
7
|
+
import type { ErrorObject } from 'ajv';
|
|
8
|
+
export declare class InvalidBlueprintError extends Error {
|
|
9
|
+
readonly validationErrors?: unknown;
|
|
10
|
+
constructor(message: string, validationErrors?: unknown);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Error thrown when a single Blueprint step fails during execution.
|
|
14
|
+
*
|
|
15
|
+
* This error carries structured information about the failing step so that
|
|
16
|
+
* consumers (e.g. the Playground UI) do not have to parse human‑readable
|
|
17
|
+
* error messages to understand what went wrong.
|
|
18
|
+
*/
|
|
19
|
+
export declare class BlueprintStepExecutionError extends Error {
|
|
20
|
+
readonly stepNumber: number;
|
|
21
|
+
readonly step: StepDefinition;
|
|
22
|
+
readonly messages: string[];
|
|
23
|
+
constructor(options: {
|
|
24
|
+
stepNumber: number;
|
|
25
|
+
step: StepDefinition;
|
|
26
|
+
cause: unknown;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
7
29
|
export type CompiledV1Step = (php: UniversalPHP) => Promise<void> | void;
|
|
8
30
|
export interface CompiledBlueprintV1 {
|
|
9
31
|
/** The requested versions of PHP and WordPress for the blueprint */
|
|
@@ -12,6 +34,7 @@ export interface CompiledBlueprintV1 {
|
|
|
12
34
|
wp: string;
|
|
13
35
|
};
|
|
14
36
|
features: {
|
|
37
|
+
/** Should boot with support for Intl dynamic extension */
|
|
15
38
|
intl: boolean;
|
|
16
39
|
/** Should boot with support for network request via wp_safe_remote_get? */
|
|
17
40
|
networking: boolean;
|
|
@@ -42,6 +65,11 @@ export interface CompileBlueprintV1Options {
|
|
|
42
65
|
* A filesystem to use for the blueprint.
|
|
43
66
|
*/
|
|
44
67
|
streamBundledFile?: StreamBundledFile;
|
|
68
|
+
/**
|
|
69
|
+
* Additional headers to pass to git operations.
|
|
70
|
+
* A function that returns headers based on the URL being accessed.
|
|
71
|
+
*/
|
|
72
|
+
gitAdditionalHeadersCallback?: (url: string) => Record<string, string>;
|
|
45
73
|
/**
|
|
46
74
|
* Additional steps to add to the blueprint.
|
|
47
75
|
*/
|
|
@@ -50,11 +78,18 @@ export interface CompileBlueprintV1Options {
|
|
|
50
78
|
export declare function compileBlueprintV1(input: BlueprintV1Declaration | BlueprintBundle, options?: Omit<CompileBlueprintV1Options, 'streamBundledFile'>): Promise<CompiledBlueprintV1>;
|
|
51
79
|
export declare function isBlueprintBundle(input: any): input is BlueprintBundle;
|
|
52
80
|
export declare function getBlueprintDeclaration(blueprint: BlueprintV1 | BlueprintBundle): Promise<BlueprintV1Declaration>;
|
|
53
|
-
export
|
|
81
|
+
export type BlueprintValidationResult = {
|
|
54
82
|
valid: true;
|
|
55
|
-
errors?: undefined;
|
|
56
83
|
} | {
|
|
57
84
|
valid: false;
|
|
58
|
-
errors:
|
|
85
|
+
errors: ErrorObject[];
|
|
59
86
|
};
|
|
87
|
+
export declare function validateBlueprint(blueprintMaybe: object): BlueprintValidationResult;
|
|
88
|
+
/**
|
|
89
|
+
* Determines if a step is a StepDefinition object
|
|
90
|
+
*
|
|
91
|
+
* @param step The object to test
|
|
92
|
+
* @returns Whether the object is a StepDefinition
|
|
93
|
+
*/
|
|
94
|
+
export declare function isStepDefinition(step: Step | string | undefined | false | null): step is StepDefinition;
|
|
60
95
|
export declare function runBlueprintV1Steps(compiledBlueprint: CompiledBlueprintV1, playground: UniversalPHP): Promise<void>;
|
package/lib/v1/resources.d.ts
CHANGED
|
@@ -3,8 +3,18 @@ import type { FileTree, UniversalPHP } from '@php-wasm/universal';
|
|
|
3
3
|
import type { Semaphore } from '@php-wasm/util';
|
|
4
4
|
import { StreamedFile } from '@php-wasm/stream-compression';
|
|
5
5
|
import type { StreamBundledFile } from './types';
|
|
6
|
+
export declare class BlueprintFilesystemRequiredError extends Error {
|
|
7
|
+
constructor(message?: string);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Error thrown when a resource could not be downloaded from a URL.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ResourceDownloadError extends Error {
|
|
13
|
+
readonly url: string;
|
|
14
|
+
constructor(message: string, url: string, options?: ErrorOptions);
|
|
15
|
+
}
|
|
6
16
|
export type { FileTree };
|
|
7
|
-
export declare const ResourceTypes: readonly ["vfs", "literal", "wordpress.org/themes", "wordpress.org/plugins", "url", "git:directory", "bundled"];
|
|
17
|
+
export declare const ResourceTypes: readonly ["vfs", "literal", "wordpress.org/themes", "wordpress.org/plugins", "url", "git:directory", "bundled", "zip"];
|
|
8
18
|
export type VFSReference = {
|
|
9
19
|
/** Identifies the file resource as Virtual File System (VFS) */
|
|
10
20
|
resource: 'vfs';
|
|
@@ -68,9 +78,44 @@ export type BundledReference = {
|
|
|
68
78
|
/** The path to the file in the Blueprint */
|
|
69
79
|
path: string;
|
|
70
80
|
};
|
|
71
|
-
export type
|
|
81
|
+
export type ZipWrapperReference = {
|
|
82
|
+
/** Identifies the resource as a ZIP wrapper */
|
|
83
|
+
resource: 'zip';
|
|
84
|
+
/** The inner resource to wrap in a ZIP file */
|
|
85
|
+
inner: FileReference | DirectoryReference;
|
|
86
|
+
/** Optional filename for the ZIP (defaults to inner resource name + .zip) */
|
|
87
|
+
name?: string;
|
|
88
|
+
};
|
|
89
|
+
export type FileReference = VFSReference | LiteralReference | CoreThemeReference | CorePluginReference | UrlReference | BundledReference | ZipWrapperReference;
|
|
72
90
|
export type DirectoryReference = GitDirectoryReference | DirectoryLiteralReference;
|
|
73
91
|
export declare function isResourceReference(ref: any): ref is FileReference;
|
|
92
|
+
/**
|
|
93
|
+
* Checks if a URL is a github-proxy.com URL that can be rewritten.
|
|
94
|
+
*
|
|
95
|
+
* @param url The URL to check
|
|
96
|
+
* @returns true if the URL is a github-proxy.com URL
|
|
97
|
+
*/
|
|
98
|
+
export declare function isGithubProxyUrl(url: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Rewrites a github-proxy.com URL to an equivalent Blueprint resource reference.
|
|
101
|
+
*
|
|
102
|
+
* github-proxy.com is being deprecated. This function enables automatic migration
|
|
103
|
+
* of existing Blueprints that use github-proxy.com URLs to native Blueprint resources.
|
|
104
|
+
*
|
|
105
|
+
* Supported URL patterns:
|
|
106
|
+
* - `?repo=owner/name` - Full repository at default branch
|
|
107
|
+
* - `?repo=owner/name&branch=trunk` - Full repository at specific branch
|
|
108
|
+
* - `?repo=owner/name&pr=123` - Full repository at PR head
|
|
109
|
+
* - `?repo=owner/name&commit=abc` - Full repository at specific commit
|
|
110
|
+
* - `?repo=owner/name&release=v1.0` - Full repository at release tag
|
|
111
|
+
* - `?repo=owner/name&directory=subdir` - Subdirectory of repository
|
|
112
|
+
* - `?repo=owner/name&release=v1.0&asset=file.zip` - Release asset download
|
|
113
|
+
* - `https://github-proxy.com/https://github.com/...` - Direct GitHub URL proxy
|
|
114
|
+
*
|
|
115
|
+
* @param url The github-proxy.com URL to rewrite
|
|
116
|
+
* @returns A ZipWrapperReference (wrapping git:directory) or UrlReference, or null if URL cannot be rewritten
|
|
117
|
+
*/
|
|
118
|
+
export declare function rewriteGithubProxyUrl(url: string): ZipWrapperReference | UrlReference | null;
|
|
74
119
|
export declare abstract class Resource<T extends File | Directory> {
|
|
75
120
|
/** Optional progress tracker to monitor progress */
|
|
76
121
|
protected _progress?: ProgressTracker;
|
|
@@ -92,12 +137,13 @@ export declare abstract class Resource<T extends File | Directory> {
|
|
|
92
137
|
* @param options Additional options for the Resource
|
|
93
138
|
* @returns A new Resource instance
|
|
94
139
|
*/
|
|
95
|
-
static create(ref: FileReference | DirectoryReference, { semaphore, progress, corsProxy, streamBundledFile, }: {
|
|
140
|
+
static create(ref: FileReference | DirectoryReference, { semaphore, progress, corsProxy, streamBundledFile, gitAdditionalHeadersCallback, }: {
|
|
96
141
|
/** Optional semaphore to limit concurrent downloads */
|
|
97
142
|
semaphore?: Semaphore;
|
|
98
143
|
progress?: ProgressTracker;
|
|
99
144
|
corsProxy?: string;
|
|
100
145
|
streamBundledFile?: StreamBundledFile;
|
|
146
|
+
gitAdditionalHeadersCallback?: (url: string) => Record<string, string>;
|
|
101
147
|
}): Resource<File | Directory>;
|
|
102
148
|
}
|
|
103
149
|
export declare abstract class ResourceDecorator<T extends File | Directory> extends Resource<T> {
|
|
@@ -204,6 +250,7 @@ export declare class GitDirectoryResource extends Resource<Directory> {
|
|
|
204
250
|
private options?;
|
|
205
251
|
constructor(reference: GitDirectoryReference, _progress?: ProgressTracker, options?: {
|
|
206
252
|
corsProxy?: string;
|
|
253
|
+
additionalHeaders?: (url: string) => Record<string, string>;
|
|
207
254
|
});
|
|
208
255
|
resolve(): Promise<{
|
|
209
256
|
name: string;
|
|
@@ -290,3 +337,19 @@ export declare class BundledResource extends Resource<File> {
|
|
|
290
337
|
/** @inheritDoc */
|
|
291
338
|
get isAsync(): boolean;
|
|
292
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* A `Resource` that wraps another resource and outputs it as a ZIP file.
|
|
342
|
+
* This is useful for converting directory resources to ZIP files, enabling
|
|
343
|
+
* compatibility with steps that expect ZIP input (like `unzip`).
|
|
344
|
+
*/
|
|
345
|
+
export declare class ZipResource extends Resource<File> {
|
|
346
|
+
private reference;
|
|
347
|
+
private innerResource;
|
|
348
|
+
constructor(reference: ZipWrapperReference, innerResource: Resource<File | Directory>, _progress?: ProgressTracker);
|
|
349
|
+
/** @inheritDoc */
|
|
350
|
+
resolve(): Promise<File>;
|
|
351
|
+
/** @inheritDoc */
|
|
352
|
+
get name(): string;
|
|
353
|
+
/** @inheritDoc */
|
|
354
|
+
get isAsync(): boolean;
|
|
355
|
+
}
|
package/lib/v1/types.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export type BlueprintV1Declaration = {
|
|
|
61
61
|
wp: string | 'latest';
|
|
62
62
|
};
|
|
63
63
|
features?: {
|
|
64
|
+
/** Should boot with support for Intl dynamic extension */
|
|
64
65
|
intl?: boolean;
|
|
65
66
|
/** Should boot with support for network request via wp_safe_remote_get? */
|
|
66
67
|
networking?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/blueprints",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.31",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./index.js",
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"./package.json": "./package.json"
|
|
10
10
|
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/WordPress/wordpress-playground"
|
|
14
|
+
},
|
|
11
15
|
"type": "module",
|
|
12
16
|
"main": "./index.cjs",
|
|
13
17
|
"module": "./index.js",
|
|
@@ -21,7 +25,7 @@
|
|
|
21
25
|
"access": "public",
|
|
22
26
|
"directory": "../../../dist/packages/playground/blueprints"
|
|
23
27
|
},
|
|
24
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "e28b6d2a2e663abc3cbb8fce9a3c5cc8abaa5bbe",
|
|
25
29
|
"engines": {
|
|
26
30
|
"node": ">=20.18.3",
|
|
27
31
|
"npm": ">=10.1.0"
|
|
@@ -41,22 +45,24 @@
|
|
|
41
45
|
"pako": "1.0.10",
|
|
42
46
|
"pify": "2.3.0",
|
|
43
47
|
"readable-stream": "3.6.2",
|
|
48
|
+
"selfsigned": "2.4.1",
|
|
44
49
|
"sha.js": "2.4.12",
|
|
45
50
|
"simple-get": "4.0.1",
|
|
46
51
|
"wasm-feature-detect": "1.8.0",
|
|
47
52
|
"ws": "8.18.3",
|
|
48
53
|
"yargs": "17.7.2",
|
|
49
|
-
"@php-wasm/node-polyfills": "3.0.
|
|
50
|
-
"@wp-playground/storage": "3.0.
|
|
51
|
-
"@wp-playground/common": "3.0.
|
|
52
|
-
"@php-wasm/universal": "3.0.
|
|
53
|
-
"@php-wasm/util": "3.0.
|
|
54
|
-
"@php-wasm/node": "3.0.
|
|
55
|
-
"@wp-playground/wordpress": "3.0.
|
|
56
|
-
"@php-wasm/logger": "3.0.
|
|
57
|
-
"@php-wasm/
|
|
58
|
-
"@php-wasm/
|
|
59
|
-
"@php-wasm/
|
|
54
|
+
"@php-wasm/node-polyfills": "3.0.31",
|
|
55
|
+
"@wp-playground/storage": "3.0.31",
|
|
56
|
+
"@wp-playground/common": "3.0.31",
|
|
57
|
+
"@php-wasm/universal": "3.0.31",
|
|
58
|
+
"@php-wasm/util": "3.0.31",
|
|
59
|
+
"@php-wasm/node": "3.0.31",
|
|
60
|
+
"@wp-playground/wordpress": "3.0.31",
|
|
61
|
+
"@php-wasm/logger": "3.0.31",
|
|
62
|
+
"@php-wasm/scopes": "3.0.31",
|
|
63
|
+
"@php-wasm/progress": "3.0.31",
|
|
64
|
+
"@php-wasm/stream-compression": "3.0.31",
|
|
65
|
+
"@php-wasm/web": "3.0.31"
|
|
60
66
|
},
|
|
61
67
|
"packageManager": "npm@10.9.2",
|
|
62
68
|
"overrides": {
|
|
@@ -64,8 +70,8 @@
|
|
|
64
70
|
"react": "18.3.1",
|
|
65
71
|
"react-dom": "18.3.1",
|
|
66
72
|
"typescript": "5.4.5",
|
|
67
|
-
"@playwright/test": "1.
|
|
68
|
-
"ws": "
|
|
73
|
+
"@playwright/test": "1.55.1",
|
|
74
|
+
"ws": "8.18.3",
|
|
69
75
|
"tmp": "0.2.5",
|
|
70
76
|
"form-data": "^4.0.4"
|
|
71
77
|
},
|