@wp-playground/blueprints 0.1.56 → 0.1.58

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.
@@ -2,11 +2,11 @@ import { StepHandler } from '.';
2
2
  export interface ActivatePluginStep {
3
3
  step: 'activatePlugin';
4
4
  pluginPath: string;
5
+ pluginName?: string;
5
6
  }
6
7
  /**
7
8
  * Activates a WordPress plugin in the Playground.
8
9
  *
9
10
  * @param playground The playground client.
10
- * @param plugin The plugin slug.
11
11
  */
12
12
  export declare const activatePlugin: StepHandler<ActivatePluginStep>;
@@ -31,7 +31,7 @@ export declare const runPHP: StepHandler<RunPHPStep>;
31
31
  * {
32
32
  * "step": "runPHP",
33
33
  * "options": {
34
- * "code": "<?php echo $_SERVER['HTTP_CONTENT_TYPE']; ?>",
34
+ * "code": "<?php echo $_SERVER['CONTENT_TYPE']; ?>",
35
35
  * "headers": {
36
36
  * "Content-type": "text/plain"
37
37
  * }
@@ -1,7 +1,10 @@
1
- import type { PHPResponse, UniversalPHP } from '@php-wasm/universal';
2
- export declare function asDOM(response: PHPResponse): Document;
1
+ import type { UniversalPHP } from '@php-wasm/universal';
3
2
  export declare function zipNameToHumanName(zipName: string): string;
4
3
  type PatchFileCallback = (contents: string) => string | Uint8Array;
5
4
  export declare function updateFile(php: UniversalPHP, path: string, callback: PatchFileCallback): Promise<void>;
6
5
  export declare function fileToUint8Array(file: File): Promise<Uint8Array>;
7
- export {};
6
+ declare const FileWithArrayBuffer: {
7
+ new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag | undefined): File;
8
+ prototype: File;
9
+ };
10
+ export { FileWithArrayBuffer as File };
@@ -26,15 +26,15 @@ export type StepDefinition = Step & {
26
26
  */
27
27
  export type GenericStep<Resource> = ActivatePluginStep | ActivateThemeStep | ApplyWordPressPatchesStep | CpStep | DefineWpConfigConstsStep | DefineSiteUrlStep | ImportFileStep<Resource> | InstallPluginStep<Resource> | InstallThemeStep<Resource> | LoginStep | MkdirStep | MvStep | RequestStep | ReplaceSiteStep<Resource> | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | SetPhpIniEntryStep | SetSiteOptionsStep | UnzipStep | UpdateUserMetaStep | WriteFileStep<Resource>;
28
28
  export type { ActivatePluginStep, ActivateThemeStep, ApplyWordPressPatchesStep, CpStep, DefineWpConfigConstsStep, DefineSiteUrlStep, ImportFileStep, InstallPluginStep, InstallPluginOptions, InstallThemeStep, InstallThemeOptions, LoginStep, MkdirStep, MvStep, RequestStep, ReplaceSiteStep, RmStep, RmdirStep, RunPHPStep, RunPHPWithOptionsStep, RunWpInstallationWizardStep, WordPressInstallationOptions, SetPhpIniEntryStep, SetSiteOptionsStep, UnzipStep, UpdateUserMetaStep, WriteFileStep, };
29
- export type StepHandler<S extends GenericStep<File>> = (
30
- /**
31
- * A PHP instance or Playground client.
32
- */
33
- php: UniversalPHP, args: Omit<S, 'step'>,
34
29
  /**
35
30
  * Progress reporting details.
36
31
  */
37
- progressArgs?: {
32
+ export type StepProgress = {
38
33
  tracker: ProgressTracker;
39
34
  initialCaption?: string;
40
- }) => any;
35
+ };
36
+ export type StepHandler<S extends GenericStep<File>> = (
37
+ /**
38
+ * A PHP instance or Playground client.
39
+ */
40
+ php: UniversalPHP, args: Omit<S, 'step'>, progressArgs?: StepProgress) => any;
@@ -0,0 +1,23 @@
1
+ import type { UniversalPHP } from '@php-wasm/universal';
2
+ export interface InstallAssetOptions {
3
+ /**
4
+ * The zip file to install.
5
+ */
6
+ zipFile: File;
7
+ /**
8
+ * Target path to extract the main folder.
9
+ * @example
10
+ *
11
+ * <code>
12
+ * const targetPath = `${await playground.documentRoot}/wp-content/plugins`;
13
+ * </code>
14
+ */
15
+ targetPath: string;
16
+ }
17
+ /**
18
+ * Install asset: Extract folder from zip file and move it to target
19
+ */
20
+ export declare function installAsset(playground: UniversalPHP, { targetPath, zipFile }: InstallAssetOptions): Promise<{
21
+ assetFolderPath: string;
22
+ assetFolderName: string;
23
+ }>;
@@ -41,8 +41,6 @@ export interface InstallPluginOptions {
41
41
  }
42
42
  /**
43
43
  * Installs a WordPress plugin in the Playground.
44
- * Technically, it uses the same plugin upload form as a WordPress user
45
- * would, and then activates the plugin if needed.
46
44
  *
47
45
  * @param playground The playground client.
48
46
  * @param pluginZipFile The plugin zip file.
@@ -45,8 +45,6 @@ export interface InstallThemeOptions {
45
45
  }
46
46
  /**
47
47
  * Installs a WordPress theme in the Playground.
48
- * Technically, it uses the same theme upload form as a WordPress user
49
- * would, and then activates the theme if needed.
50
48
  *
51
49
  * @param playground The playground client.
52
50
  * @param themeZipFile The theme zip file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-playground/blueprints",
3
- "version": "0.1.56",
3
+ "version": "0.1.58",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./index.js",
@@ -21,5 +21,5 @@
21
21
  "access": "public",
22
22
  "directory": "../../../dist/packages/playground/blueprints"
23
23
  },
24
- "gitHead": "af3583eb7c6644a9859ea4782702c6e2c3474821"
24
+ "gitHead": "dbc77ed4c0b0a2625cfbe08722fade036c69a425"
25
25
  }