@wp-playground/blueprints 0.1.42 → 0.1.45
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 +26 -19
- package/index.js +423 -398
- package/lib/steps/common.d.ts +2 -0
- package/lib/steps/define-virtual-wp-config-consts.d.ts +19 -0
- package/lib/steps/define-wp-config-consts.d.ts +4 -0
- package/lib/steps/handlers.d.ts +1 -0
- package/lib/steps/index.d.ts +6 -4
- package/lib/steps/install-plugin.d.ts +24 -0
- package/package.json +2 -2
package/lib/steps/common.d.ts
CHANGED
|
@@ -4,4 +4,6 @@ export declare function zipNameToHumanName(zipName: string): string;
|
|
|
4
4
|
type PatchFileCallback = (contents: string) => string | Uint8Array;
|
|
5
5
|
export declare function updateFile(php: UniversalPHP, path: string, callback: PatchFileCallback): Promise<void>;
|
|
6
6
|
export declare function fileToUint8Array(file: File): Promise<Uint8Array>;
|
|
7
|
+
export declare const VFS_CONFIG_FILE_BASENAME = "/vfs-blueprints";
|
|
8
|
+
export declare const VFS_CONFIG_FILE_PATH = "/vfs-blueprints/wp-config-consts.php";
|
|
7
9
|
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* The step object for defining constants in the VFS_CONFIG_FILE_PATH php file and loaded using the auto_prepend_file php.ini directive.
|
|
4
|
+
*/
|
|
5
|
+
export interface DefineVirtualWpConfigConstsStep {
|
|
6
|
+
step: 'defineVirtualWpConfigConsts';
|
|
7
|
+
/** The constants to define */
|
|
8
|
+
consts: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Function to define constants in the virtual VFS_CONFIG_FILE_PATH php file of a WordPress installation.
|
|
12
|
+
* The file should be dynamically loaded using the auto_prepend_file php.ini directive after this step.
|
|
13
|
+
*
|
|
14
|
+
* @param playground The playground client.
|
|
15
|
+
* @param wpConfigConst An object containing the constants to be defined and the optional virtual file system configuration file path.
|
|
16
|
+
* @returns Returns the virtual file system configuration file path.
|
|
17
|
+
* @see {@link https://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file}
|
|
18
|
+
*/
|
|
19
|
+
export declare const defineVirtualWpConfigConsts: StepHandler<DefineVirtualWpConfigConstsStep>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* The step object for defining constants in the wp-config.php file of a WordPress installation.
|
|
4
|
+
*/
|
|
2
5
|
export interface DefineWpConfigConstsStep {
|
|
3
6
|
step: 'defineWpConfigConsts';
|
|
7
|
+
/** The constants to define */
|
|
4
8
|
consts: Record<string, unknown>;
|
|
5
9
|
}
|
|
6
10
|
/**
|
package/lib/steps/handlers.d.ts
CHANGED
|
@@ -9,3 +9,4 @@ export { login } from './login';
|
|
|
9
9
|
export { runWpInstallationWizard } from './run-wp-installation-wizard';
|
|
10
10
|
export { setSiteOptions, updateUserMeta } from './site-data';
|
|
11
11
|
export { defineWpConfigConsts } from './define-wp-config-consts';
|
|
12
|
+
export { defineVirtualWpConfigConsts } from './define-virtual-wp-config-consts';
|
package/lib/steps/index.d.ts
CHANGED
|
@@ -5,13 +5,14 @@ import { ActivatePluginStep } from './activate-plugin';
|
|
|
5
5
|
import { ApplyWordPressPatchesStep } from './apply-wordpress-patches';
|
|
6
6
|
import { DefineSiteUrlStep } from './define-site-url';
|
|
7
7
|
import { ImportFileStep, ReplaceSiteStep, UnzipStep } from './import-export';
|
|
8
|
-
import { InstallPluginStep } from './install-plugin';
|
|
9
|
-
import { InstallThemeStep } from './install-theme';
|
|
8
|
+
import { InstallPluginStep, InstallPluginOptions } from './install-plugin';
|
|
9
|
+
import { InstallThemeStep, InstallThemeOptions } from './install-theme';
|
|
10
10
|
import { LoginStep } from './login';
|
|
11
|
-
import { RunWpInstallationWizardStep } from './run-wp-installation-wizard';
|
|
11
|
+
import { RunWpInstallationWizardStep, WordPressInstallationOptions } from './run-wp-installation-wizard';
|
|
12
12
|
import { SetSiteOptionsStep, UpdateUserMetaStep } from './site-data';
|
|
13
13
|
import { RmStep, CpStep, MkdirStep, RmdirStep, MvStep, SetPhpIniEntryStep, RunPHPStep, RunPHPWithOptionsStep, RequestStep, WriteFileStep } from './client-methods';
|
|
14
14
|
import { DefineWpConfigConstsStep } from './define-wp-config-consts';
|
|
15
|
+
import { DefineVirtualWpConfigConstsStep } from './define-virtual-wp-config-consts';
|
|
15
16
|
export type Step = GenericStep<FileReference>;
|
|
16
17
|
export type StepDefinition = Step & {
|
|
17
18
|
progress?: {
|
|
@@ -19,7 +20,8 @@ export type StepDefinition = Step & {
|
|
|
19
20
|
caption?: string;
|
|
20
21
|
};
|
|
21
22
|
};
|
|
22
|
-
export type GenericStep<Resource> = ActivatePluginStep | 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>;
|
|
23
|
+
export type GenericStep<Resource> = ActivatePluginStep | ApplyWordPressPatchesStep | CpStep | DefineWpConfigConstsStep | DefineVirtualWpConfigConstsStep | DefineSiteUrlStep | ImportFileStep<Resource> | InstallPluginStep<Resource> | InstallThemeStep<Resource> | LoginStep | MkdirStep | MvStep | RequestStep | ReplaceSiteStep<Resource> | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | SetPhpIniEntryStep | SetSiteOptionsStep | UnzipStep | UpdateUserMetaStep | WriteFileStep<Resource>;
|
|
24
|
+
export type { ActivatePluginStep, 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, };
|
|
23
25
|
export type StepHandler<S extends GenericStep<File>> = (php: UniversalPHP, args: Omit<S, 'step'>, progressArgs?: {
|
|
24
26
|
tracker: ProgressTracker;
|
|
25
27
|
initialCaption?: string;
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
import { StepHandler } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* The step to install a WordPress plugin in the Playground.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
*
|
|
7
|
+
* <code>
|
|
8
|
+
* {
|
|
9
|
+
* "step": "installPlugin",
|
|
10
|
+
* "pluginZipFile": "http://example.com/plugin.zip",
|
|
11
|
+
* "options": {
|
|
12
|
+
* "activate": true
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* </code>
|
|
16
|
+
*/
|
|
2
17
|
export interface InstallPluginStep<ResourceType> {
|
|
18
|
+
/**
|
|
19
|
+
* The step identifier.
|
|
20
|
+
*/
|
|
3
21
|
step: 'installPlugin';
|
|
22
|
+
/**
|
|
23
|
+
* The plugin zip file to install.
|
|
24
|
+
*/
|
|
4
25
|
pluginZipFile: ResourceType;
|
|
26
|
+
/**
|
|
27
|
+
* Optional installation options.
|
|
28
|
+
*/
|
|
5
29
|
options?: InstallPluginOptions;
|
|
6
30
|
}
|
|
7
31
|
export interface InstallPluginOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/blueprints",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
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": "
|
|
24
|
+
"gitHead": "ca75514c17b912dc8b5dc529f6d123295671320a"
|
|
25
25
|
}
|