@wp-playground/blueprints 3.1.42 → 3.1.44
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 +2087 -1532
- package/blueprint-schema.json +43 -0
- package/index.cjs +151 -80
- package/index.cjs.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +3868 -2917
- package/index.js.map +1 -1
- package/lib/compile.d.ts +29 -0
- package/lib/is-git-repo-url.d.ts +8 -0
- package/lib/steps/import-wxr.d.ts +24 -0
- package/lib/steps/install-plugin.d.ts +12 -0
- package/lib/steps/install-theme.d.ts +9 -0
- package/lib/v1/compile.d.ts +1 -1
- package/lib/v2/compile.d.ts +117 -0
- package/lib/v2/wep-1-blueprint-v2-schema/appendix-A-blueprint-v2-schema.d.ts +112 -87
- package/lib/v2/wep-1-blueprint-v2-schema/appendix-B-data-sources.d.ts +26 -6
- package/package.json +11 -11
package/lib/compile.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { UniversalPHP } from '@php-wasm/universal';
|
|
2
|
+
import type { Blueprint, BlueprintBundle, BlueprintDeclaration } from './types';
|
|
3
|
+
import { type CompileBlueprintV1Options, type CompiledBlueprintV1 } from './v1/compile';
|
|
4
|
+
import type { BlueprintV1Declaration } from './v1/types';
|
|
5
|
+
import type { BlueprintV2Declaration } from './v2/blueprint-v2-declaration';
|
|
6
|
+
import { type CompiledBlueprintV2 } from './v2/compile';
|
|
7
|
+
export type BlueprintExecutionPath = 'v1' | 'v2';
|
|
8
|
+
export type CompiledBlueprintForExecution = {
|
|
9
|
+
version: 1;
|
|
10
|
+
declaration: BlueprintV1Declaration;
|
|
11
|
+
compiled: CompiledBlueprintV1;
|
|
12
|
+
run: (playground: UniversalPHP) => Promise<void>;
|
|
13
|
+
} | {
|
|
14
|
+
version: 2;
|
|
15
|
+
declaration: BlueprintV2Declaration;
|
|
16
|
+
compiled: CompiledBlueprintV2;
|
|
17
|
+
run: (playground: UniversalPHP) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
export interface CompileBlueprintForExecutionOptions extends Omit<CompileBlueprintV1Options, 'onBlueprintValidated' | 'streamBundledFile'> {
|
|
20
|
+
onBlueprintValidated?: (blueprint: BlueprintDeclaration) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Compiles a Blueprint into the shape consumers need before execution.
|
|
24
|
+
*
|
|
25
|
+
* The legacy `compileBlueprint()` export intentionally remains v1-only for
|
|
26
|
+
* backwards compatibility. This helper is the version-aware entrypoint that
|
|
27
|
+
* newer callers can migrate to as Blueprint v2 support grows.
|
|
28
|
+
*/
|
|
29
|
+
export declare function compileBlueprintForExecution(input: Blueprint | BlueprintBundle, options?: CompileBlueprintForExecutionOptions): Promise<CompiledBlueprintForExecution>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heuristically indicates whether a URL looks like a Git repository.
|
|
3
|
+
*
|
|
4
|
+
* Blueprint compilers use this to distinguish plugin/theme repository URLs
|
|
5
|
+
* from downloadable ZIP URLs. This is intentionally a small allowlist of URL
|
|
6
|
+
* shapes Playground can clone, not a general Git remote detector.
|
|
7
|
+
*/
|
|
8
|
+
export declare function seemsLikeGitRepoUrl(url: string): boolean;
|
|
@@ -17,6 +17,30 @@ export interface ImportWxrStep<ResourceType> {
|
|
|
17
17
|
step: 'importWxr';
|
|
18
18
|
/** The file to import */
|
|
19
19
|
file: ResourceType;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to fetch and import attachment files referenced by the WXR file.
|
|
22
|
+
*
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
fetchAttachments?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to rewrite imported URLs to the current site URL.
|
|
28
|
+
*
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
rewriteUrls?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether to import comments from the WXR file.
|
|
34
|
+
*
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
importComments?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The fallback local user for imported authors that cannot be mapped.
|
|
40
|
+
*
|
|
41
|
+
* @default "admin"
|
|
42
|
+
*/
|
|
43
|
+
defaultAuthorUsername?: string;
|
|
20
44
|
/**
|
|
21
45
|
* The importer to use. Possible values:
|
|
22
46
|
*
|
|
@@ -62,10 +62,22 @@ export interface InstallPluginOptions {
|
|
|
62
62
|
* Whether to activate the plugin after installing it.
|
|
63
63
|
*/
|
|
64
64
|
activate?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Parameters to expose to the plugin during its activation hook.
|
|
67
|
+
*/
|
|
68
|
+
activationOptions?: Record<string, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* Whether installation/activation failures should abort the Blueprint.
|
|
71
|
+
*/
|
|
72
|
+
onError?: 'skip-plugin' | 'throw';
|
|
65
73
|
/**
|
|
66
74
|
* The name of the folder to install the plugin to. Defaults to guessing from pluginData
|
|
67
75
|
*/
|
|
68
76
|
targetFolderName?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Human-readable plugin name for progress captions and skip warnings.
|
|
79
|
+
*/
|
|
80
|
+
humanReadableName?: string;
|
|
69
81
|
}
|
|
70
82
|
/**
|
|
71
83
|
* Installs a WordPress plugin in the Playground.
|
|
@@ -49,10 +49,19 @@ export interface InstallThemeOptions {
|
|
|
49
49
|
* Whether to import the theme's starter content after installing it.
|
|
50
50
|
*/
|
|
51
51
|
importStarterContent?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether installation, activation, or starter-content failures should
|
|
54
|
+
* abort the Blueprint.
|
|
55
|
+
*/
|
|
56
|
+
onError?: 'skip-theme' | 'throw';
|
|
52
57
|
/**
|
|
53
58
|
* The name of the folder to install the theme to. Defaults to guessing from themeData
|
|
54
59
|
*/
|
|
55
60
|
targetFolderName?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Human-readable theme name for the progress caption and skip warning.
|
|
63
|
+
*/
|
|
64
|
+
humanReadableName?: string;
|
|
56
65
|
}
|
|
57
66
|
/**
|
|
58
67
|
* Installs a WordPress theme in the Playground.
|
package/lib/v1/compile.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export interface CompileBlueprintV1Options {
|
|
|
75
75
|
*/
|
|
76
76
|
additionalSteps?: any[];
|
|
77
77
|
}
|
|
78
|
-
export declare function compileBlueprintV1(input: BlueprintV1Declaration | BlueprintBundle, options?:
|
|
78
|
+
export declare function compileBlueprintV1(input: BlueprintV1Declaration | BlueprintBundle, options?: CompileBlueprintV1Options): Promise<CompiledBlueprintV1>;
|
|
79
79
|
export declare function isBlueprintBundle(input: any): input is BlueprintBundle;
|
|
80
80
|
export declare function getBlueprintDeclaration(blueprint: BlueprintV1 | BlueprintBundle): Promise<BlueprintV1Declaration>;
|
|
81
81
|
export type BlueprintValidationResult = {
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { UniversalPHP } from '@php-wasm/universal';
|
|
2
|
+
import type { RuntimeConfiguration } from '../types';
|
|
3
|
+
import { type CompileBlueprintV1Options } from '../v1/compile';
|
|
4
|
+
import type { StepDefinition } from '../steps';
|
|
5
|
+
import type { BlueprintV2Declaration } from './blueprint-v2-declaration';
|
|
6
|
+
export declare class UnsupportedBlueprintV2FeatureError extends Error {
|
|
7
|
+
readonly featurePath: string;
|
|
8
|
+
constructor(featurePath: string, message?: string);
|
|
9
|
+
}
|
|
10
|
+
type BlueprintV2ApplicationOptions = BlueprintV2Declaration['applicationOptions'];
|
|
11
|
+
type BlueprintV2Constants = NonNullable<BlueprintV2Declaration['constants']>;
|
|
12
|
+
type BlueprintV2SiteOptions = NonNullable<BlueprintV2Declaration['siteOptions']>;
|
|
13
|
+
type BlueprintV2MuPlugin = NonNullable<BlueprintV2Declaration['muPlugins']>[number];
|
|
14
|
+
type BlueprintV2Theme = NonNullable<BlueprintV2Declaration['themes']>[number];
|
|
15
|
+
type BlueprintV2ActiveTheme = NonNullable<BlueprintV2Declaration['activeTheme']>;
|
|
16
|
+
type BlueprintV2Plugin = NonNullable<BlueprintV2Declaration['plugins']>[number];
|
|
17
|
+
type BlueprintV2Fonts = NonNullable<BlueprintV2Declaration['fonts']>;
|
|
18
|
+
type BlueprintV2Media = NonNullable<BlueprintV2Declaration['media']>[number];
|
|
19
|
+
type BlueprintV2Role = NonNullable<BlueprintV2Declaration['roles']>[number];
|
|
20
|
+
type BlueprintV2User = NonNullable<BlueprintV2Declaration['users']>[number];
|
|
21
|
+
type BlueprintV2PostTypes = NonNullable<BlueprintV2Declaration['postTypes']>;
|
|
22
|
+
type BlueprintV2Content = NonNullable<BlueprintV2Declaration['content']>[number];
|
|
23
|
+
type BlueprintV2Step = NonNullable<BlueprintV2Declaration['additionalStepsAfterExecution']>[number];
|
|
24
|
+
export type BlueprintV2ExecutionPlan = BlueprintV2ExecutionPlanItem[];
|
|
25
|
+
export type BlueprintV2StepPlan = StepDefinition[];
|
|
26
|
+
export type BlueprintV2StepPlanLoweringResult = {
|
|
27
|
+
steps: BlueprintV2StepPlan;
|
|
28
|
+
unsupportedPlan: BlueprintV2ExecutionPlan;
|
|
29
|
+
};
|
|
30
|
+
export type BlueprintV2ExecutionPlanItem = {
|
|
31
|
+
type: 'defineWpConfigConsts';
|
|
32
|
+
consts: BlueprintV2Constants;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'setSiteOptions';
|
|
35
|
+
options: BlueprintV2SiteOptions;
|
|
36
|
+
} | {
|
|
37
|
+
type: 'installMuPlugin';
|
|
38
|
+
muPlugin: BlueprintV2MuPlugin;
|
|
39
|
+
sourcePath: string;
|
|
40
|
+
} | {
|
|
41
|
+
type: 'installTheme';
|
|
42
|
+
theme: BlueprintV2Theme;
|
|
43
|
+
active: false;
|
|
44
|
+
sourcePath: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'installTheme';
|
|
47
|
+
theme: BlueprintV2ActiveTheme;
|
|
48
|
+
active: true;
|
|
49
|
+
sourcePath: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'installPlugin';
|
|
52
|
+
plugin: BlueprintV2Plugin;
|
|
53
|
+
sourcePath: string;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'installFonts';
|
|
56
|
+
fonts: BlueprintV2Fonts;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'importMedia';
|
|
59
|
+
media: BlueprintV2Media;
|
|
60
|
+
sourcePath: string;
|
|
61
|
+
} | {
|
|
62
|
+
type: 'setSiteLanguage';
|
|
63
|
+
language: string;
|
|
64
|
+
} | {
|
|
65
|
+
type: 'defineRoles';
|
|
66
|
+
roles: BlueprintV2Role[];
|
|
67
|
+
} | {
|
|
68
|
+
type: 'defineUsers';
|
|
69
|
+
users: BlueprintV2User[];
|
|
70
|
+
} | {
|
|
71
|
+
type: 'definePostTypes';
|
|
72
|
+
postTypes: BlueprintV2PostTypes;
|
|
73
|
+
} | {
|
|
74
|
+
type: 'importContent';
|
|
75
|
+
content: BlueprintV2Content;
|
|
76
|
+
sourcePath: string;
|
|
77
|
+
} | {
|
|
78
|
+
type: 'runStep';
|
|
79
|
+
step: BlueprintV2Step;
|
|
80
|
+
sourcePath: string;
|
|
81
|
+
};
|
|
82
|
+
export type CompiledBlueprintV2 = {
|
|
83
|
+
runtime: RuntimeConfiguration;
|
|
84
|
+
applicationOptions?: BlueprintV2ApplicationOptions;
|
|
85
|
+
plan: BlueprintV2ExecutionPlan;
|
|
86
|
+
steps: BlueprintV2StepPlan;
|
|
87
|
+
unsupportedPlan: BlueprintV2ExecutionPlan;
|
|
88
|
+
run: (playground: UniversalPHP) => Promise<void>;
|
|
89
|
+
};
|
|
90
|
+
export type CompileBlueprintV2Options = Pick<CompileBlueprintV1Options, 'streamBundledFile'>;
|
|
91
|
+
/**
|
|
92
|
+
* Compiles a Blueprint v2 declaration into the pieces the TypeScript runner can
|
|
93
|
+
* understand today.
|
|
94
|
+
*
|
|
95
|
+
* It resolves runtime options, creates an ordered v2 execution plan, and lowers
|
|
96
|
+
* supported plan items into v1 step records. Fully lowered plans run through the
|
|
97
|
+
* existing v1 runner; unsupported items stay visible and block execution before
|
|
98
|
+
* any partial work is applied.
|
|
99
|
+
*/
|
|
100
|
+
export declare function compileBlueprintV2(declaration: BlueprintV2Declaration, options?: CompileBlueprintV2Options): Promise<CompiledBlueprintV2>;
|
|
101
|
+
/**
|
|
102
|
+
* Converts the top-level Blueprint v2 fields into a simple ordered plan.
|
|
103
|
+
*
|
|
104
|
+
* The plan keeps the original v2 data intact. It only decides execution order
|
|
105
|
+
* and records where each item came from, which makes unsupported items visible
|
|
106
|
+
* instead of silently dropping them during lowering.
|
|
107
|
+
*/
|
|
108
|
+
export declare function createBlueprintV2ExecutionPlan(declaration: BlueprintV2Declaration): BlueprintV2ExecutionPlan;
|
|
109
|
+
/**
|
|
110
|
+
* Converts the supported v2 plan items into v1-compatible step records.
|
|
111
|
+
*
|
|
112
|
+
* The v1 step runner already knows how to install plugins, install themes, set
|
|
113
|
+
* options, and run several imperative steps. This function reuses those shapes
|
|
114
|
+
* while keeping unsupported v2-only work in `unsupportedPlan` for future PRs.
|
|
115
|
+
*/
|
|
116
|
+
export declare function lowerBlueprintV2ExecutionPlan(plan: BlueprintV2ExecutionPlan): BlueprintV2StepPlanLoweringResult;
|
|
117
|
+
export {};
|
|
@@ -159,12 +159,12 @@ export declare namespace V2Schema {
|
|
|
159
159
|
* @default "latest".
|
|
160
160
|
*/
|
|
161
161
|
wordpressVersion?: DataSources.WordPressVersion | DataSources.DataReference | {
|
|
162
|
-
min: DataSources.
|
|
163
|
-
max?: DataSources.
|
|
162
|
+
min: DataSources.WordPressVersionConstraintVersion;
|
|
163
|
+
max?: DataSources.WordPressVersionConstraintVersion;
|
|
164
164
|
/**
|
|
165
165
|
* @default "latest"
|
|
166
166
|
*/
|
|
167
|
-
preferred?: DataSources.
|
|
167
|
+
preferred?: DataSources.WordPressVersionPreferredVersion;
|
|
168
168
|
};
|
|
169
169
|
/**
|
|
170
170
|
* The PHP version required for this Blueprint to work.
|
|
@@ -180,9 +180,9 @@ export declare namespace V2Schema {
|
|
|
180
180
|
* @see https://github.com/WordPress/blueprints-library/issues/47
|
|
181
181
|
*/
|
|
182
182
|
phpVersion?: DataSources.PHPVersion | {
|
|
183
|
-
min?: DataSources.
|
|
184
|
-
recommended?: DataSources.
|
|
185
|
-
max?: DataSources.
|
|
183
|
+
min?: DataSources.PHPVersionConstraintVersion;
|
|
184
|
+
recommended?: DataSources.PHPVersionConstraintVersion;
|
|
185
|
+
max?: DataSources.PHPVersionConstraintVersion;
|
|
186
186
|
};
|
|
187
187
|
/**
|
|
188
188
|
* The theme to install and also activate.
|
|
@@ -196,9 +196,13 @@ export declare namespace V2Schema {
|
|
|
196
196
|
* @example `"activeTheme": "adventurer@4.6.0"`
|
|
197
197
|
* @example
|
|
198
198
|
* ```json
|
|
199
|
-
*
|
|
200
|
-
* "
|
|
201
|
-
* "
|
|
199
|
+
* {
|
|
200
|
+
* "version": 2,
|
|
201
|
+
* "activeTheme": {
|
|
202
|
+
* "source": "https://github.com/richtabor/kanso/archive/refs/heads/main.zip",
|
|
203
|
+
* "targetDirectoryName": "kanso",
|
|
204
|
+
* "importStarterContent": true
|
|
205
|
+
* }
|
|
202
206
|
* }
|
|
203
207
|
* ```
|
|
204
208
|
*/
|
|
@@ -209,14 +213,17 @@ export declare namespace V2Schema {
|
|
|
209
213
|
* Example:
|
|
210
214
|
*
|
|
211
215
|
* ```json
|
|
212
|
-
*
|
|
213
|
-
* "
|
|
214
|
-
* "
|
|
215
|
-
*
|
|
216
|
-
* "
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
216
|
+
* {
|
|
217
|
+
* "version": 2,
|
|
218
|
+
* "themes": [
|
|
219
|
+
* "stylish-press-theme",
|
|
220
|
+
* "adventurer@4.6.0",
|
|
221
|
+
* {
|
|
222
|
+
* "source": "https://github.com/richtabor/kanso/archive/refs/heads/main.zip",
|
|
223
|
+
* "targetDirectoryName": "kanso"
|
|
224
|
+
* }
|
|
225
|
+
* ]
|
|
226
|
+
* }
|
|
220
227
|
* ```
|
|
221
228
|
*/
|
|
222
229
|
themes?: ThemeDefinition[];
|
|
@@ -226,16 +233,20 @@ export declare namespace V2Schema {
|
|
|
226
233
|
* Example:
|
|
227
234
|
*
|
|
228
235
|
* ```json
|
|
229
|
-
*
|
|
230
|
-
* "
|
|
231
|
-
* "
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
* "
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
236
|
+
* {
|
|
237
|
+
* "version": 2,
|
|
238
|
+
* "plugins": [
|
|
239
|
+
* "jetpack",
|
|
240
|
+
* "akismet@6.4.3",
|
|
241
|
+
* "./query-monitor.php",
|
|
242
|
+
* "./code-block.zip",
|
|
243
|
+
* {
|
|
244
|
+
* "source": "https://github.com/woocommerce/woocommerce/archive/refs/heads/6.4.3.zip",
|
|
245
|
+
* "active": false
|
|
246
|
+
* }
|
|
247
|
+
* ]
|
|
248
|
+
* }
|
|
249
|
+
* ```
|
|
239
250
|
*/
|
|
240
251
|
plugins?: PluginDefinition[];
|
|
241
252
|
/**
|
|
@@ -244,14 +255,15 @@ export declare namespace V2Schema {
|
|
|
244
255
|
* Example:
|
|
245
256
|
*
|
|
246
257
|
* ```json
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
258
|
+
* {
|
|
259
|
+
* "version": 2,
|
|
260
|
+
* "muPlugins": [
|
|
261
|
+
* {
|
|
250
262
|
* "filename": "addFilter-0.php",
|
|
251
263
|
* "content": "<?php add_action( 'requests-requests.before_request', function( &$url ) {\n$url = 'https://playground.wordpress.net/cors-proxy.php?' . $url;\n} );"
|
|
252
264
|
* }
|
|
253
|
-
*
|
|
254
|
-
*
|
|
265
|
+
* ]
|
|
266
|
+
* }
|
|
255
267
|
* ```
|
|
256
268
|
*/
|
|
257
269
|
muPlugins?: Array<DataSources.DataReference>;
|
|
@@ -366,10 +378,10 @@ export declare namespace V2Schema {
|
|
|
366
378
|
};
|
|
367
379
|
type ContentDefinition = ({
|
|
368
380
|
type: 'mysql-dump';
|
|
369
|
-
source: DataSources.
|
|
381
|
+
source: DataSources.FileDataReference | DataSources.FileDataReference[];
|
|
370
382
|
} & URLMappingConfig) | ({
|
|
371
383
|
type: 'posts';
|
|
372
|
-
source: DataSources.
|
|
384
|
+
source: DataSources.FileDataReference | DataSources.FileDataReference[] | WordPressPost | WordPressPost[];
|
|
373
385
|
} & URLMappingConfig)
|
|
374
386
|
/**
|
|
375
387
|
* WXR files to import.
|
|
@@ -377,36 +389,33 @@ export declare namespace V2Schema {
|
|
|
377
389
|
* Example:
|
|
378
390
|
*
|
|
379
391
|
* ```json
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
392
|
+
* {
|
|
393
|
+
* "version": 2,
|
|
394
|
+
* "content": [
|
|
395
|
+
* {
|
|
396
|
+
* "type": "wxr",
|
|
397
|
+
* "source": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/stylish-press/woo-products.wxr"
|
|
398
|
+
* },
|
|
399
|
+
* {
|
|
400
|
+
* "type": "wxr",
|
|
401
|
+
* "source": "https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/stylish-press/site-content.wxr",
|
|
402
|
+
* "urlsMode": "rewrite",
|
|
403
|
+
* "staticAssets": "hotlink",
|
|
404
|
+
* "importUsers": false,
|
|
405
|
+
* "importComments": false
|
|
406
|
+
* }
|
|
407
|
+
* ]
|
|
408
|
+
* }
|
|
394
409
|
* ```
|
|
395
410
|
*/
|
|
396
|
-
|
|
|
397
|
-
|
|
398
|
-
source: DataSources.DataReference;
|
|
411
|
+
| WXRContentDefinition;
|
|
412
|
+
type WXRContentDefinition = WXRContentBase & ({
|
|
399
413
|
/**
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
* Possible values:
|
|
403
|
-
*
|
|
404
|
-
* * "fetch" – Fetch the static assets and save them to the local filesystem.
|
|
405
|
-
* * "hotlink" – Hotlink the static assets from the remote site.
|
|
406
|
-
*
|
|
407
|
-
* @default "fetch".
|
|
414
|
+
* Map remote authors to existing local authors.
|
|
408
415
|
*/
|
|
409
|
-
|
|
416
|
+
authorsMode: 'map';
|
|
417
|
+
authorsMap: Record<RemoteUsername, LocalUsername>;
|
|
418
|
+
} | {
|
|
410
419
|
/**
|
|
411
420
|
* How to handle authors that don't exist on the current site.
|
|
412
421
|
*
|
|
@@ -414,28 +423,32 @@ export declare namespace V2Schema {
|
|
|
414
423
|
*
|
|
415
424
|
* * "create" – Create a new author.
|
|
416
425
|
* * "default-author" – Use the default author.
|
|
417
|
-
* * "map" – Map the author to an existing author on the current site.
|
|
418
426
|
*
|
|
419
427
|
* @default "create".
|
|
420
428
|
*/
|
|
421
|
-
authorsMode?: 'create' | 'default-author'
|
|
429
|
+
authorsMode?: 'create' | 'default-author';
|
|
430
|
+
authorsMap?: Record<RemoteUsername, LocalUsername>;
|
|
431
|
+
});
|
|
432
|
+
type WXRContentBase = {
|
|
433
|
+
type: 'wxr';
|
|
434
|
+
source: DataSources.FileDataReference | DataSources.FileDataReference[];
|
|
422
435
|
/**
|
|
423
|
-
*
|
|
436
|
+
* Static assets handling.
|
|
424
437
|
*
|
|
425
|
-
*
|
|
426
|
-
*/
|
|
427
|
-
defaultAuthorUsername?: string;
|
|
428
|
-
/**
|
|
429
|
-
* Map post authors from the remote site to the current site.
|
|
438
|
+
* Possible values:
|
|
430
439
|
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
440
|
+
* * "fetch" – Fetch the static assets and save them to the local filesystem.
|
|
441
|
+
* * "hotlink" – Hotlink the static assets from the remote site.
|
|
433
442
|
*
|
|
434
|
-
*
|
|
443
|
+
* @default "fetch".
|
|
444
|
+
*/
|
|
445
|
+
staticAssets?: 'fetch' | 'hotlink';
|
|
446
|
+
/**
|
|
447
|
+
* The default author to use when `mode` is "default-author".
|
|
435
448
|
*
|
|
436
|
-
* @default
|
|
449
|
+
* @default "admin".
|
|
437
450
|
*/
|
|
438
|
-
|
|
451
|
+
defaultAuthorUsername?: string;
|
|
439
452
|
/**
|
|
440
453
|
* Whether to import users from the remote site.
|
|
441
454
|
*
|
|
@@ -448,15 +461,9 @@ export declare namespace V2Schema {
|
|
|
448
461
|
* @default false.
|
|
449
462
|
*/
|
|
450
463
|
importComments?: boolean;
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
* @default false.
|
|
455
|
-
*/
|
|
456
|
-
importSiteOptions?: boolean;
|
|
457
|
-
} & URLMappingConfig);
|
|
458
|
-
type MediaDefinition = DataSources.DataReference | {
|
|
459
|
-
source: DataSources.DataReference;
|
|
464
|
+
} & URLMappingConfig;
|
|
465
|
+
type MediaDefinition = DataSources.FileDataReference | {
|
|
466
|
+
source: DataSources.FileDataReference;
|
|
460
467
|
title?: string;
|
|
461
468
|
description?: string;
|
|
462
469
|
alt?: string;
|
|
@@ -540,6 +547,12 @@ export declare namespace V2Schema {
|
|
|
540
547
|
* @default "throw"
|
|
541
548
|
*/
|
|
542
549
|
onError?: 'skip-plugin' | 'throw';
|
|
550
|
+
/**
|
|
551
|
+
* How to handle a plugin that is already installed.
|
|
552
|
+
*
|
|
553
|
+
* @default "overwrite"
|
|
554
|
+
*/
|
|
555
|
+
ifAlreadyInstalled?: 'overwrite' | 'skip' | 'error';
|
|
543
556
|
/**
|
|
544
557
|
* Human-readable name of the plugin for the progress bar.
|
|
545
558
|
*
|
|
@@ -573,6 +586,18 @@ export declare namespace V2Schema {
|
|
|
573
586
|
* If not provided, it will be inferred from the theme source.
|
|
574
587
|
*/
|
|
575
588
|
targetDirectoryName?: string;
|
|
589
|
+
/**
|
|
590
|
+
* Sometimes it's fine when a theme fails to install.
|
|
591
|
+
*
|
|
592
|
+
* @default "throw"
|
|
593
|
+
*/
|
|
594
|
+
onError?: 'skip-theme' | 'throw';
|
|
595
|
+
/**
|
|
596
|
+
* How to handle a theme that is already installed.
|
|
597
|
+
*
|
|
598
|
+
* @default "overwrite"
|
|
599
|
+
*/
|
|
600
|
+
ifAlreadyInstalled?: 'overwrite' | 'skip' | 'error';
|
|
576
601
|
/**
|
|
577
602
|
* Human-readable name of the theme for the progress bar.
|
|
578
603
|
*
|
|
@@ -594,8 +619,8 @@ export declare namespace V2Schema {
|
|
|
594
619
|
*/
|
|
595
620
|
humanReadableName?: string;
|
|
596
621
|
};
|
|
597
|
-
type RemoteUsername =
|
|
598
|
-
type LocalUsername =
|
|
622
|
+
type RemoteUsername = string;
|
|
623
|
+
type LocalUsername = string;
|
|
599
624
|
/**
|
|
600
625
|
* WordPress register_post_type() arguments representation. {{{
|
|
601
626
|
*
|
|
@@ -1327,7 +1352,7 @@ export declare namespace V2Schema {
|
|
|
1327
1352
|
/**
|
|
1328
1353
|
* The PHP file to execute.
|
|
1329
1354
|
*/
|
|
1330
|
-
code: DataSources.
|
|
1355
|
+
code: DataSources.FileDataReference;
|
|
1331
1356
|
/**
|
|
1332
1357
|
* Environment variables to set for this run.
|
|
1333
1358
|
*/
|
|
@@ -1335,7 +1360,7 @@ export declare namespace V2Schema {
|
|
|
1335
1360
|
};
|
|
1336
1361
|
type RunSQLStep = {
|
|
1337
1362
|
step: 'runSQL';
|
|
1338
|
-
source: DataSources.
|
|
1363
|
+
source: DataSources.FileDataReference;
|
|
1339
1364
|
};
|
|
1340
1365
|
/**
|
|
1341
1366
|
* Sets the site language and download translations for WordPress core
|
|
@@ -1364,7 +1389,7 @@ export declare namespace V2Schema {
|
|
|
1364
1389
|
/**
|
|
1365
1390
|
* The zip file resource to extract.
|
|
1366
1391
|
*/
|
|
1367
|
-
zipFile: DataSources.
|
|
1392
|
+
zipFile: DataSources.FileDataReference;
|
|
1368
1393
|
/**
|
|
1369
1394
|
* The path to extract the zip file to inside the virtual filesystem.
|
|
1370
1395
|
*/
|
|
@@ -67,7 +67,15 @@ export declare namespace DataSources {
|
|
|
67
67
|
*/
|
|
68
68
|
export type InlineDirectory = {
|
|
69
69
|
directoryName: string;
|
|
70
|
-
files: Record<string, InlineFileContent |
|
|
70
|
+
files: Record<string, InlineFileContent | NestedInlineDirectory>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* A child directory inside an inline directory.
|
|
74
|
+
*
|
|
75
|
+
* Its directory name comes from the parent `files` record key.
|
|
76
|
+
*/
|
|
77
|
+
export type NestedInlineDirectory = {
|
|
78
|
+
files: Record<string, InlineFileContent | NestedInlineDirectory>;
|
|
71
79
|
};
|
|
72
80
|
/**
|
|
73
81
|
* A reference to a remote git repository.
|
|
@@ -94,6 +102,10 @@ export declare namespace DataSources {
|
|
|
94
102
|
* A union of all general data reference types.
|
|
95
103
|
*/
|
|
96
104
|
export type DataReference = URLReference | ExecutionContextPath | InlineFile | InlineDirectory | GitPath;
|
|
105
|
+
/**
|
|
106
|
+
* A data reference that must resolve to a single file.
|
|
107
|
+
*/
|
|
108
|
+
export type FileDataReference = URLReference | ExecutionContextPath | InlineFile;
|
|
97
109
|
/**
|
|
98
110
|
* }}}
|
|
99
111
|
*/
|
|
@@ -118,7 +130,12 @@ export declare namespace DataSources {
|
|
|
118
130
|
*/
|
|
119
131
|
export type Slug = string;
|
|
120
132
|
export type SimpleVersionExpression = 'latest' | `${number}.${number}` | `${number}.${number}.${number}`;
|
|
121
|
-
export type
|
|
133
|
+
export type VersionNumberComponent = `${bigint}`;
|
|
134
|
+
export type ComparableVersionExpression = `${VersionNumberComponent}.${VersionNumberComponent}` | `${VersionNumberComponent}.${VersionNumberComponent}.${VersionNumberComponent}`;
|
|
135
|
+
export type WordPressVersionSuffix = `beta${VersionNumberComponent}` | `rc${VersionNumberComponent}`;
|
|
136
|
+
export type WordPressVersionConstraintVersion = ComparableVersionExpression | `${ComparableVersionExpression}-${WordPressVersionSuffix}`;
|
|
137
|
+
export type WordPressVersionPreferredVersion = 'latest' | WordPressVersionConstraintVersion;
|
|
138
|
+
export type PHPVersionConstraintVersion = SimpleVersionExpression;
|
|
122
139
|
/** }}} Helper types */
|
|
123
140
|
/**
|
|
124
141
|
* Plugin directory reference, e.g. "jetpack", "jetpack@6.4", or "akismet@6.4.3".
|
|
@@ -149,7 +166,8 @@ export declare namespace DataSources {
|
|
|
149
166
|
*/
|
|
150
167
|
export type ThemeDirectoryReference = Slug | `${Slug}@${SimpleVersionExpression}`;
|
|
151
168
|
/**
|
|
152
|
-
* WordPress version, e.g. "
|
|
169
|
+
* WordPress version, e.g. "latest", "beta", "trunk", "6.4",
|
|
170
|
+
* "6.4.3", "6.8-RC1", or "6.7-beta2".
|
|
153
171
|
*
|
|
154
172
|
* These refer to slugs of specific WordPress releases as listed in
|
|
155
173
|
* the first table column on https://wordpress.org/download/releases/.
|
|
@@ -157,16 +175,18 @@ export declare namespace DataSources {
|
|
|
157
175
|
* The WordPressVersion type is only meaningful in the top-level
|
|
158
176
|
* `wordpressVersion` property.
|
|
159
177
|
*/
|
|
160
|
-
export type WordPressVersion = SimpleVersionExpression | `${SimpleVersionExpression}-${WordPressVersionSuffix}`;
|
|
178
|
+
export type WordPressVersion = 'beta' | 'trunk' | 'nightly' | SimpleVersionExpression | `${SimpleVersionExpression}-${WordPressVersionSuffix}`;
|
|
161
179
|
/**
|
|
162
|
-
* PHP version, e.g. "8.1"
|
|
180
|
+
* PHP version, e.g. "8.1", "8.1.3", or "next".
|
|
163
181
|
*
|
|
164
182
|
* These refer to PHP versions as listed in https://www.php.net/releases/.
|
|
183
|
+
* `next` previews the php-src development branch and is currently
|
|
184
|
+
* supported by the web runtime only.
|
|
165
185
|
*
|
|
166
186
|
* The PHPVersion type is only meaningful in the top-level
|
|
167
187
|
* `phpVersion` property.
|
|
168
188
|
*/
|
|
169
|
-
export type PHPVersion = SimpleVersionExpression;
|
|
189
|
+
export type PHPVersion = SimpleVersionExpression | 'next';
|
|
170
190
|
/**
|
|
171
191
|
* A path within the built WordPress site, relative to the WordPress root
|
|
172
192
|
* directory. For example, site:wp-content/uploads/2024/01/image.jpg.
|