@wp-playground/client 0.6.8 → 0.6.10

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.
Files changed (4) hide show
  1. package/index.cjs +36 -26
  2. package/index.d.ts +21 -26
  3. package/index.js +1058 -1025
  4. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -207,6 +207,7 @@ export interface PHPRequestEndEvent {
207
207
  export interface PHPRequestErrorEvent {
208
208
  type: "request.error";
209
209
  error: Error;
210
+ source?: "request" | "php-wasm";
210
211
  }
211
212
  /**
212
213
  * Represents a PHP runtime initialization event.
@@ -672,11 +673,6 @@ export interface PHPRunOptions {
672
673
  * The code snippet to eval instead of a php file.
673
674
  */
674
675
  code?: string;
675
- /**
676
- * Whether to throw an error if the PHP process exits with a non-zero code
677
- * or outputs to stderr.
678
- */
679
- throwOnError?: boolean;
680
676
  }
681
677
  /**
682
678
  * Output of the PHP.wasm runtime.
@@ -730,7 +726,7 @@ export declare const LatestSupportedPHPVersion: "8.3";
730
726
  export declare const SupportedPHPVersionsList: string[];
731
727
  export type SupportedPHPVersion = (typeof SupportedPHPVersions)[number];
732
728
  export type SupportedPHPExtension = "iconv" | "mbstring" | "xml-bundle" | "gd";
733
- export type SupportedPHPExtensionBundle = "kitchen-sink";
729
+ export type SupportedPHPExtensionBundle = "kitchen-sink" | "light";
734
730
  export type RewriteRule = {
735
731
  match: RegExp;
736
732
  replacement: string;
@@ -1831,33 +1827,31 @@ export interface ImportWordPressFilesStep<ResourceType> {
1831
1827
  */
1832
1828
  export declare const importWordPressFiles: StepHandler<ImportWordPressFilesStep<File>>;
1833
1829
  /**
1834
- * @inheritDoc importFile
1830
+ * @inheritDoc importWxr
1835
1831
  * @example
1836
1832
  *
1837
1833
  * <code>
1838
1834
  * {
1839
- * "step": "importFile",
1835
+ * "step": "importWxr",
1840
1836
  * "file": {
1841
1837
  * "resource": "url",
1842
- * "url": "https://your-site.com/starter-content.wxz"
1838
+ * "url": "https://your-site.com/starter-content.wxr"
1843
1839
  * }
1844
1840
  * }
1845
1841
  * </code>
1846
1842
  */
1847
- export interface ImportFileStep<ResourceType> {
1848
- step: "importFile";
1843
+ export interface ImportWxrStep<ResourceType> {
1844
+ step: "importWxr";
1849
1845
  /** The file to import */
1850
1846
  file: ResourceType;
1851
1847
  }
1852
1848
  /**
1853
- * Uploads a file to the WordPress importer and returns the response.
1854
- * Supports both WXR and WXZ files.
1849
+ * Imports a WXR file into WordPress.
1855
1850
  *
1856
- * @see https://github.com/WordPress/wordpress-importer/compare/master...akirk:wordpress-importer:import-wxz.patch
1857
1851
  * @param playground Playground client.
1858
1852
  * @param file The file to import.
1859
1853
  */
1860
- export declare const importFile: StepHandler<ImportFileStep<File>>;
1854
+ export declare const importWxr: StepHandler<ImportWxrStep<File>>;
1861
1855
  /**
1862
1856
  * @inheritDoc enableMultisite
1863
1857
  * @hasRunnableExample
@@ -1888,7 +1882,7 @@ export declare const enableMultisite: StepHandler<EnableMultisiteStep>;
1888
1882
  *
1889
1883
  * <code>
1890
1884
  * {
1891
- * "step": "wpCLI",
1885
+ * "step": "wp-cli",
1892
1886
  * "command": "wp post create --post_title='Test post' --post_excerpt='Some content'"
1893
1887
  * }
1894
1888
  * </code>
@@ -1922,7 +1916,7 @@ export type StepDefinition = Step & {
1922
1916
  * If you add a step here, make sure to also
1923
1917
  * add it to the exports below.
1924
1918
  */
1925
- export type GenericStep<Resource> = ActivatePluginStep | ActivateThemeStep | CpStep | DefineWpConfigConstsStep | DefineSiteUrlStep | EnableMultisiteStep | ImportFileStep<Resource> | ImportWordPressFilesStep<Resource> | InstallPluginStep<Resource> | InstallThemeStep<Resource> | LoginStep | MkdirStep | MvStep | RequestStep | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | RunSqlStep<Resource> | SetPhpIniEntryStep | SetSiteOptionsStep | UnzipStep<Resource> | UpdateUserMetaStep | WriteFileStep<Resource> | WPCLIStep;
1919
+ 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> | SetPhpIniEntryStep | SetSiteOptionsStep | UnzipStep<Resource> | UpdateUserMetaStep | WriteFileStep<Resource> | WPCLIStep;
1926
1920
  /**
1927
1921
  * Progress reporting details.
1928
1922
  */
@@ -1943,14 +1937,6 @@ php: UniversalPHP, args: Omit<S, "step">, progressArgs?: StepProgress) => Return
1943
1937
  * @returns WXR file
1944
1938
  */
1945
1939
  export declare function exportWXR(playground: UniversalPHP): Promise<File>;
1946
- /**
1947
- * Exports the WordPress database as a WXZ file using
1948
- * the export-wxz plugin from https://github.com/akirk/export-wxz.
1949
- *
1950
- * @param playground Playground client
1951
- * @returns WXZ file
1952
- */
1953
- export declare function exportWXZ(playground: UniversalPHP): Promise<File>;
1954
1940
  export interface ZipWpContentOptions {
1955
1941
  /**
1956
1942
  * @private
@@ -2276,6 +2262,7 @@ declare class PlaygroundWorkerEndpoint extends WebPHPEndpoint {
2276
2262
  all: {
2277
2263
  nightly: string;
2278
2264
  beta: string;
2265
+ "6.5": string;
2279
2266
  "6.4": string;
2280
2267
  "6.3": string;
2281
2268
  "6.2": string;
@@ -2349,6 +2336,14 @@ export interface StartPlaygroundOptions {
2349
2336
  disableProgressBar?: boolean;
2350
2337
  blueprint?: Blueprint;
2351
2338
  onBlueprintStepCompleted?: OnStepCompleted;
2339
+ /**
2340
+ * Called when the playground client is connected, but before the blueprint
2341
+ * steps are run.
2342
+ *
2343
+ * @param playground
2344
+ * @returns
2345
+ */
2346
+ onClientConnected?: (playground: PlaygroundClient) => void;
2352
2347
  /**
2353
2348
  * The SAPI name PHP will use.
2354
2349
  * @internal
@@ -2363,7 +2358,7 @@ export interface StartPlaygroundOptions {
2363
2358
  * @param options Options for loading the playground.
2364
2359
  * @returns A PlaygroundClient instance.
2365
2360
  */
2366
- export declare function startPlaygroundWeb({ iframe, blueprint, remoteUrl, progressTracker, disableProgressBar, onBlueprintStepCompleted, sapiName, }: StartPlaygroundOptions): Promise<PlaygroundClient>;
2361
+ export declare function startPlaygroundWeb({ iframe, blueprint, remoteUrl, progressTracker, disableProgressBar, onBlueprintStepCompleted, onClientConnected, sapiName, }: StartPlaygroundOptions): Promise<PlaygroundClient>;
2367
2362
  /**
2368
2363
  * @deprecated Use `startPlayground` instead.
2369
2364
  *