@wp-playground/client 0.6.7 → 0.6.9
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/index.cjs +28 -28
- package/index.d.ts +53 -10
- package/index.js +964 -835
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -201,6 +201,14 @@ export declare class PHPResponse implements PHPResponseData {
|
|
|
201
201
|
export interface PHPRequestEndEvent {
|
|
202
202
|
type: "request.end";
|
|
203
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Represents an error event related to the PHP request.
|
|
206
|
+
*/
|
|
207
|
+
export interface PHPRequestErrorEvent {
|
|
208
|
+
type: "request.error";
|
|
209
|
+
error: Error;
|
|
210
|
+
source?: "request" | "php-wasm";
|
|
211
|
+
}
|
|
204
212
|
/**
|
|
205
213
|
* Represents a PHP runtime initialization event.
|
|
206
214
|
*/
|
|
@@ -218,7 +226,7 @@ export interface PHPRuntimeBeforeDestroyEvent {
|
|
|
218
226
|
* This is intentionally not an extension of CustomEvent
|
|
219
227
|
* to make it isomorphic between different JavaScript runtimes.
|
|
220
228
|
*/
|
|
221
|
-
export type PHPEvent = PHPRequestEndEvent | PHPRuntimeInitializedEvent | PHPRuntimeBeforeDestroyEvent;
|
|
229
|
+
export type PHPEvent = PHPRequestEndEvent | PHPRequestErrorEvent | PHPRuntimeInitializedEvent | PHPRuntimeBeforeDestroyEvent;
|
|
222
230
|
/**
|
|
223
231
|
* A callback function that handles PHP events.
|
|
224
232
|
*/
|
|
@@ -665,11 +673,6 @@ export interface PHPRunOptions {
|
|
|
665
673
|
* The code snippet to eval instead of a php file.
|
|
666
674
|
*/
|
|
667
675
|
code?: string;
|
|
668
|
-
/**
|
|
669
|
-
* Whether to throw an error if the PHP process exits with a non-zero code
|
|
670
|
-
* or outputs to stderr.
|
|
671
|
-
*/
|
|
672
|
-
throwOnError?: boolean;
|
|
673
676
|
}
|
|
674
677
|
/**
|
|
675
678
|
* Output of the PHP.wasm runtime.
|
|
@@ -724,6 +727,10 @@ export declare const SupportedPHPVersionsList: string[];
|
|
|
724
727
|
export type SupportedPHPVersion = (typeof SupportedPHPVersions)[number];
|
|
725
728
|
export type SupportedPHPExtension = "iconv" | "mbstring" | "xml-bundle" | "gd";
|
|
726
729
|
export type SupportedPHPExtensionBundle = "kitchen-sink";
|
|
730
|
+
export type RewriteRule = {
|
|
731
|
+
match: RegExp;
|
|
732
|
+
replacement: string;
|
|
733
|
+
};
|
|
727
734
|
export interface PHPRequestHandlerConfiguration {
|
|
728
735
|
/**
|
|
729
736
|
* The directory in the PHP filesystem where the server will look
|
|
@@ -734,10 +741,15 @@ export interface PHPRequestHandlerConfiguration {
|
|
|
734
741
|
* Request Handler URL. Used to populate $_SERVER details like HTTP_HOST.
|
|
735
742
|
*/
|
|
736
743
|
absoluteUrl?: string;
|
|
744
|
+
/**
|
|
745
|
+
* Rewrite rules
|
|
746
|
+
*/
|
|
747
|
+
rewriteRules?: RewriteRule[];
|
|
737
748
|
}
|
|
738
749
|
/** @inheritDoc */
|
|
739
750
|
export declare class PHPRequestHandler implements RequestHandler {
|
|
740
751
|
#private;
|
|
752
|
+
rewriteRules: RewriteRule[];
|
|
741
753
|
/**
|
|
742
754
|
* The PHP instance
|
|
743
755
|
*/
|
|
@@ -1721,8 +1733,7 @@ export declare const defineWpConfigConsts: StepHandler<DefineWpConfigConstsStep>
|
|
|
1721
1733
|
* <code>
|
|
1722
1734
|
* {
|
|
1723
1735
|
* "step": "activateTheme",
|
|
1724
|
-
* "
|
|
1725
|
-
* "pluginPath": "/wordpress/wp-content/themes/storefront"
|
|
1736
|
+
* "themeFolderName": "storefront"
|
|
1726
1737
|
* }
|
|
1727
1738
|
* </code>
|
|
1728
1739
|
*/
|
|
@@ -1873,7 +1884,7 @@ export declare const enableMultisite: StepHandler<EnableMultisiteStep>;
|
|
|
1873
1884
|
*
|
|
1874
1885
|
* <code>
|
|
1875
1886
|
* {
|
|
1876
|
-
* "step": "
|
|
1887
|
+
* "step": "wp-cli",
|
|
1877
1888
|
* "command": "wp post create --post_title='Test post' --post_excerpt='Some content'"
|
|
1878
1889
|
* }
|
|
1879
1890
|
* </code>
|
|
@@ -1960,8 +1971,31 @@ export interface Blueprint {
|
|
|
1960
1971
|
* Optional description. It doesn't do anything but is exposed as
|
|
1961
1972
|
* a courtesy to developers who may want to document which blueprint
|
|
1962
1973
|
* file does what.
|
|
1974
|
+
*
|
|
1975
|
+
* @deprecated Use meta.description instead.
|
|
1963
1976
|
*/
|
|
1964
1977
|
description?: string;
|
|
1978
|
+
/**
|
|
1979
|
+
* Optional metadata. Used by the Blueprints gallery at https://github.com/WordPress/blueprints
|
|
1980
|
+
*/
|
|
1981
|
+
meta?: {
|
|
1982
|
+
/**
|
|
1983
|
+
* A clear and concise name for your Blueprint.
|
|
1984
|
+
*/
|
|
1985
|
+
title: string;
|
|
1986
|
+
/**
|
|
1987
|
+
* A brief explanation of what your Blueprint offers.
|
|
1988
|
+
*/
|
|
1989
|
+
description?: string;
|
|
1990
|
+
/**
|
|
1991
|
+
* A GitHub username of the author of this Blueprint.
|
|
1992
|
+
*/
|
|
1993
|
+
author: string;
|
|
1994
|
+
/**
|
|
1995
|
+
* Relevant categories to help users find your Blueprint in the future Blueprints section on WordPress.org.
|
|
1996
|
+
*/
|
|
1997
|
+
categories?: string[];
|
|
1998
|
+
};
|
|
1965
1999
|
/**
|
|
1966
2000
|
* The preferred PHP and WordPress versions to use.
|
|
1967
2001
|
*/
|
|
@@ -2238,6 +2272,7 @@ declare class PlaygroundWorkerEndpoint extends WebPHPEndpoint {
|
|
|
2238
2272
|
all: {
|
|
2239
2273
|
nightly: string;
|
|
2240
2274
|
beta: string;
|
|
2275
|
+
"6.5": string;
|
|
2241
2276
|
"6.4": string;
|
|
2242
2277
|
"6.3": string;
|
|
2243
2278
|
"6.2": string;
|
|
@@ -2311,6 +2346,14 @@ export interface StartPlaygroundOptions {
|
|
|
2311
2346
|
disableProgressBar?: boolean;
|
|
2312
2347
|
blueprint?: Blueprint;
|
|
2313
2348
|
onBlueprintStepCompleted?: OnStepCompleted;
|
|
2349
|
+
/**
|
|
2350
|
+
* Called when the playground client is connected, but before the blueprint
|
|
2351
|
+
* steps are run.
|
|
2352
|
+
*
|
|
2353
|
+
* @param playground
|
|
2354
|
+
* @returns
|
|
2355
|
+
*/
|
|
2356
|
+
onClientConnected?: (playground: PlaygroundClient) => void;
|
|
2314
2357
|
/**
|
|
2315
2358
|
* The SAPI name PHP will use.
|
|
2316
2359
|
* @internal
|
|
@@ -2325,7 +2368,7 @@ export interface StartPlaygroundOptions {
|
|
|
2325
2368
|
* @param options Options for loading the playground.
|
|
2326
2369
|
* @returns A PlaygroundClient instance.
|
|
2327
2370
|
*/
|
|
2328
|
-
export declare function startPlaygroundWeb({ iframe, blueprint, remoteUrl, progressTracker, disableProgressBar, onBlueprintStepCompleted, sapiName, }: StartPlaygroundOptions): Promise<PlaygroundClient>;
|
|
2371
|
+
export declare function startPlaygroundWeb({ iframe, blueprint, remoteUrl, progressTracker, disableProgressBar, onBlueprintStepCompleted, onClientConnected, sapiName, }: StartPlaygroundOptions): Promise<PlaygroundClient>;
|
|
2329
2372
|
/**
|
|
2330
2373
|
* @deprecated Use `startPlayground` instead.
|
|
2331
2374
|
*
|