@wp-playground/blueprints 3.1.44 → 3.1.46
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.d.ts +4 -1
- package/blueprint-schema-validator.js +2322 -1831
- package/blueprint-schema.json +3067 -1
- package/blueprint-v2-schema-validator.d.ts +5 -0
- package/blueprint-v2-schema-validator.js +37821 -0
- package/index.cjs +974 -151
- package/index.cjs.map +1 -1
- package/index.d.ts +7 -4
- package/index.js +7203 -5120
- package/index.js.map +1 -1
- package/lib/compile.d.ts +5 -2
- package/lib/invalid-blueprint-error.d.ts +5 -0
- package/lib/reflection.d.ts +1 -1
- package/lib/resolve-runtime-configuration.d.ts +13 -1
- package/lib/steps/import-wxr.d.ts +20 -0
- package/lib/steps/reset-data.d.ts +9 -2
- package/lib/v1/compile.d.ts +2 -4
- package/lib/v2/blueprint-v2-declaration.d.ts +0 -10
- package/lib/v2/compile.d.ts +23 -2
- package/lib/v2/resolve-runtime-configuration.d.ts +20 -0
- package/lib/v2/validate-blueprint-v2.d.ts +17 -0
- package/lib/v2/wep-1-blueprint-v2-schema/appendix-A-blueprint-v2-schema.d.ts +91 -17
- package/lib/v2/wep-1-blueprint-v2-schema/appendix-B-data-sources.d.ts +54 -15
- package/lib/validate-blueprint-declaration.d.ts +6 -0
- package/package.json +11 -11
- package/schema-readme.md +6 -5
- package/tests/v2/schema-conformance-fixtures.d.ts +2033 -0
- package/validate-blueprint-v2-C3rgpKFU.js +17393 -0
- package/validate-blueprint-v2-C3rgpKFU.js.map +1 -0
- package/validate-blueprint-v2-CGFpDXlD.cjs +201 -0
- package/validate-blueprint-v2-CGFpDXlD.cjs.map +1 -0
- package/validate-blueprint-v2-CJ8Xbxyz.cjs +201 -0
- package/validate-blueprint-v2-CJ8Xbxyz.cjs.map +1 -0
- package/validate-blueprint-v2-IqJfvfcL.js +17393 -0
- package/validate-blueprint-v2-IqJfvfcL.js.map +1 -0
- package/blueprints-Gs5fAvvo.cjs +0 -2
- package/blueprints-Gs5fAvvo.cjs.map +0 -1
- package/blueprints-pMn3V9MZ.js +0 -5
- package/blueprints-pMn3V9MZ.js.map +0 -1
- package/lib/v2/get-v2-runner.d.ts +0 -1
- package/lib/v2/run-blueprint-v2.d.ts +0 -36
package/lib/compile.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type CompileBlueprintV1Options, type CompiledBlueprintV1 } from './v1/c
|
|
|
4
4
|
import type { BlueprintV1Declaration } from './v1/types';
|
|
5
5
|
import type { BlueprintV2Declaration } from './v2/blueprint-v2-declaration';
|
|
6
6
|
import { type CompiledBlueprintV2 } from './v2/compile';
|
|
7
|
+
import type { ResolveRuntimeConfigurationOptions } from './resolve-runtime-configuration';
|
|
7
8
|
export type BlueprintExecutionPath = 'v1' | 'v2';
|
|
8
9
|
export type CompiledBlueprintForExecution = {
|
|
9
10
|
version: 1;
|
|
@@ -16,9 +17,10 @@ export type CompiledBlueprintForExecution = {
|
|
|
16
17
|
compiled: CompiledBlueprintV2;
|
|
17
18
|
run: (playground: UniversalPHP) => Promise<void>;
|
|
18
19
|
};
|
|
19
|
-
export interface CompileBlueprintForExecutionOptions extends Omit<CompileBlueprintV1Options, 'onBlueprintValidated' | 'streamBundledFile'
|
|
20
|
+
export interface CompileBlueprintForExecutionOptions extends Omit<CompileBlueprintV1Options, 'onBlueprintValidated' | 'streamBundledFile'>, ResolveRuntimeConfigurationOptions {
|
|
20
21
|
onBlueprintValidated?: (blueprint: BlueprintDeclaration) => void;
|
|
21
22
|
}
|
|
23
|
+
type BlueprintExecutionInput = Blueprint | BlueprintBundle | string;
|
|
22
24
|
/**
|
|
23
25
|
* Compiles a Blueprint into the shape consumers need before execution.
|
|
24
26
|
*
|
|
@@ -26,4 +28,5 @@ export interface CompileBlueprintForExecutionOptions extends Omit<CompileBluepri
|
|
|
26
28
|
* backwards compatibility. This helper is the version-aware entrypoint that
|
|
27
29
|
* newer callers can migrate to as Blueprint v2 support grows.
|
|
28
30
|
*/
|
|
29
|
-
export declare function compileBlueprintForExecution(input:
|
|
31
|
+
export declare function compileBlueprintForExecution(input: BlueprintExecutionInput, options?: CompileBlueprintForExecutionOptions): Promise<CompiledBlueprintForExecution>;
|
|
32
|
+
export {};
|
package/lib/reflection.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Blueprint, BlueprintBundle } from './types';
|
|
|
2
2
|
import type { BlueprintV1Declaration } from './v1/types';
|
|
3
3
|
import type { BlueprintV2Declaration } from './v2/blueprint-v2-declaration';
|
|
4
4
|
export declare function isBlueprintBundle(input: any): input is BlueprintBundle;
|
|
5
|
-
export declare function getBlueprintDeclaration(blueprint: Blueprint): Promise<BlueprintV1Declaration | BlueprintV2Declaration>;
|
|
5
|
+
export declare function getBlueprintDeclaration(blueprint: Blueprint | string): Promise<BlueprintV1Declaration | BlueprintV2Declaration>;
|
|
6
6
|
export type BlueprintType = 'bundle' | 'declaration';
|
|
7
7
|
export declare class BlueprintReflection {
|
|
8
8
|
private readonly declaration;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
import type { Blueprint, RuntimeConfiguration } from './types';
|
|
2
|
-
|
|
2
|
+
import { type BlueprintV2SiteMode } from './v2/resolve-runtime-configuration';
|
|
3
|
+
export type ResolveRuntimeConfigurationOptions = {
|
|
4
|
+
/** Determines whether WordPress is selected for download or checked in place. */
|
|
5
|
+
siteMode?: BlueprintV2SiteMode;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the runtime settings required before executing a Blueprint.
|
|
9
|
+
*
|
|
10
|
+
* Blueprint v1 settings come from its compiled form. Blueprint v2 settings are
|
|
11
|
+
* delegated to the v2 runtime configuration resolver. Existing-site mode
|
|
12
|
+
* validates WordPress constraints without selecting a release to download.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveRuntimeConfiguration(blueprint: Blueprint, options?: ResolveRuntimeConfigurationOptions): Promise<RuntimeConfiguration>;
|
|
@@ -29,6 +29,10 @@ export interface ImportWxrStep<ResourceType> {
|
|
|
29
29
|
* @default true
|
|
30
30
|
*/
|
|
31
31
|
rewriteUrls?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Explicit URL replacements to apply when URL rewriting is enabled.
|
|
34
|
+
*/
|
|
35
|
+
urlMapping?: Record<string, string>;
|
|
32
36
|
/**
|
|
33
37
|
* Whether to import comments from the WXR file.
|
|
34
38
|
*
|
|
@@ -41,6 +45,22 @@ export interface ImportWxrStep<ResourceType> {
|
|
|
41
45
|
* @default "admin"
|
|
42
46
|
*/
|
|
43
47
|
defaultAuthorUsername?: string;
|
|
48
|
+
/**
|
|
49
|
+
* How to assign imported WXR authors to local WordPress users.
|
|
50
|
+
*
|
|
51
|
+
* @default "default-author"
|
|
52
|
+
*/
|
|
53
|
+
authorsMode?: 'create' | 'default-author' | 'map';
|
|
54
|
+
/**
|
|
55
|
+
* Remote WXR author usernames keyed to existing local usernames.
|
|
56
|
+
*/
|
|
57
|
+
authorsMap?: Record<string, string>;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to create local users for imported WXR authors.
|
|
60
|
+
*
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
importUsers?: boolean;
|
|
44
64
|
/**
|
|
45
65
|
* The importer to use. Possible values:
|
|
46
66
|
*
|
|
@@ -11,10 +11,17 @@ import type { StepHandler } from '.';
|
|
|
11
11
|
*/
|
|
12
12
|
export interface ResetDataStep {
|
|
13
13
|
step: 'resetData';
|
|
14
|
+
/**
|
|
15
|
+
* Content types to remove. When omitted, all posts, pages, custom post
|
|
16
|
+
* types, and comments are removed.
|
|
17
|
+
*/
|
|
18
|
+
contentTypes?: Array<'posts' | 'pages' | 'comments'>;
|
|
14
19
|
}
|
|
15
20
|
/**
|
|
16
|
-
* Deletes
|
|
17
|
-
*
|
|
21
|
+
* Deletes the selected WordPress content through WordPress APIs so dependent
|
|
22
|
+
* records are removed with it. Empty tables have their sequences reset so
|
|
23
|
+
* later imports receive the identifiers they would on a site without the
|
|
24
|
+
* removed content.
|
|
18
25
|
*
|
|
19
26
|
* @param playground Playground client.
|
|
20
27
|
*/
|
package/lib/v1/compile.d.ts
CHANGED
|
@@ -5,10 +5,8 @@ import type { Step, StepDefinition } from '../steps';
|
|
|
5
5
|
import type { BlueprintV1Declaration, ExtraLibrary, StreamBundledFile, BlueprintV1 } from './types';
|
|
6
6
|
import type { BlueprintBundle } from '../types';
|
|
7
7
|
import type { ErrorObject } from 'ajv';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
constructor(message: string, validationErrors?: unknown);
|
|
11
|
-
}
|
|
8
|
+
import { InvalidBlueprintError } from '../invalid-blueprint-error';
|
|
9
|
+
export { InvalidBlueprintError };
|
|
12
10
|
/**
|
|
13
11
|
* Error thrown when a single Blueprint step fails during execution.
|
|
14
12
|
*
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import type { BlueprintBundle } from '../types';
|
|
2
|
-
import type { BlueprintV1Declaration } from '../v1/types';
|
|
3
2
|
import type { V2Schema } from './wep-1-blueprint-v2-schema/appendix-A-blueprint-v2-schema';
|
|
4
3
|
type BlueprintV2Declaration = V2Schema.BlueprintV2;
|
|
5
4
|
export type BlueprintV2 = BlueprintV2Declaration | BlueprintBundle;
|
|
6
5
|
export type { BlueprintV2Declaration };
|
|
7
|
-
export type RawBlueprintV2Data = string | BlueprintV2Declaration | undefined;
|
|
8
|
-
export type ParsedBlueprintV1orV2String = {
|
|
9
|
-
type: 'inline-file';
|
|
10
|
-
contents: string;
|
|
11
|
-
} | {
|
|
12
|
-
type: 'file-reference';
|
|
13
|
-
reference: string;
|
|
14
|
-
};
|
|
15
|
-
export declare function parseBlueprintDeclaration(source: RawBlueprintV2Data | ParsedBlueprintV1orV2String | BlueprintV1Declaration): ParsedBlueprintV1orV2String;
|
package/lib/v2/compile.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { UniversalPHP } from '@php-wasm/universal';
|
|
2
2
|
import type { RuntimeConfiguration } from '../types';
|
|
3
|
+
import type { ResolveRuntimeConfigurationOptions } from '../resolve-runtime-configuration';
|
|
3
4
|
import { type CompileBlueprintV1Options } from '../v1/compile';
|
|
4
5
|
import type { StepDefinition } from '../steps';
|
|
5
6
|
import type { BlueprintV2Declaration } from './blueprint-v2-declaration';
|
|
7
|
+
import { type BlueprintV2SiteMode } from './resolve-runtime-configuration';
|
|
6
8
|
export declare class UnsupportedBlueprintV2FeatureError extends Error {
|
|
7
9
|
readonly featurePath: string;
|
|
8
10
|
constructor(featurePath: string, message?: string);
|
|
9
11
|
}
|
|
10
12
|
type BlueprintV2ApplicationOptions = BlueprintV2Declaration['applicationOptions'];
|
|
13
|
+
type BlueprintV2ContentBaseline = NonNullable<BlueprintV2Declaration['contentBaseline']>;
|
|
11
14
|
type BlueprintV2Constants = NonNullable<BlueprintV2Declaration['constants']>;
|
|
12
15
|
type BlueprintV2SiteOptions = NonNullable<BlueprintV2Declaration['siteOptions']>;
|
|
13
16
|
type BlueprintV2MuPlugin = NonNullable<BlueprintV2Declaration['muPlugins']>[number];
|
|
@@ -28,6 +31,13 @@ export type BlueprintV2StepPlanLoweringResult = {
|
|
|
28
31
|
unsupportedPlan: BlueprintV2ExecutionPlan;
|
|
29
32
|
};
|
|
30
33
|
export type BlueprintV2ExecutionPlanItem = {
|
|
34
|
+
type: 'applyContentBaseline';
|
|
35
|
+
contentBaseline: BlueprintV2ContentBaseline;
|
|
36
|
+
sourcePath: '/contentBaseline';
|
|
37
|
+
} | {
|
|
38
|
+
type: 'applyUsersBaseline';
|
|
39
|
+
sourcePath: '/usersBaseline';
|
|
40
|
+
} | {
|
|
31
41
|
type: 'defineWpConfigConsts';
|
|
32
42
|
consts: BlueprintV2Constants;
|
|
33
43
|
} | {
|
|
@@ -87,7 +97,10 @@ export type CompiledBlueprintV2 = {
|
|
|
87
97
|
unsupportedPlan: BlueprintV2ExecutionPlan;
|
|
88
98
|
run: (playground: UniversalPHP) => Promise<void>;
|
|
89
99
|
};
|
|
90
|
-
export type CompileBlueprintV2Options = Pick<CompileBlueprintV1Options, 'streamBundledFile'
|
|
100
|
+
export type CompileBlueprintV2Options = Pick<CompileBlueprintV1Options, 'progress' | 'streamBundledFile'> & ResolveRuntimeConfigurationOptions & {
|
|
101
|
+
onBlueprintValidated?: (blueprint: BlueprintV2Declaration) => void;
|
|
102
|
+
};
|
|
103
|
+
export type ResolveBlueprintV2WordPressSourceOptions = Pick<CompileBlueprintV1Options, 'corsProxy' | 'gitAdditionalHeadersCallback' | 'progress' | 'semaphore' | 'streamBundledFile'>;
|
|
91
104
|
/**
|
|
92
105
|
* Compiles a Blueprint v2 declaration into the pieces the TypeScript runner can
|
|
93
106
|
* understand today.
|
|
@@ -98,6 +111,14 @@ export type CompileBlueprintV2Options = Pick<CompileBlueprintV1Options, 'streamB
|
|
|
98
111
|
* any partial work is applied.
|
|
99
112
|
*/
|
|
100
113
|
export declare function compileBlueprintV2(declaration: BlueprintV2Declaration, options?: CompileBlueprintV2Options): Promise<CompiledBlueprintV2>;
|
|
114
|
+
/**
|
|
115
|
+
* Loads a custom WordPress source into the file expected by the boot API.
|
|
116
|
+
*
|
|
117
|
+
* Built-in versions and HTTP(S) ZIP URLs already use each consumer's normal
|
|
118
|
+
* WordPress download path. Execution-context, inline, and Git references need
|
|
119
|
+
* the Blueprint resource loader to turn them into a concrete archive first.
|
|
120
|
+
*/
|
|
121
|
+
export declare function resolveBlueprintV2WordPressSource(declaration: BlueprintV2Declaration, options?: ResolveBlueprintV2WordPressSourceOptions): Promise<File | undefined>;
|
|
101
122
|
/**
|
|
102
123
|
* Converts the top-level Blueprint v2 fields into a simple ordered plan.
|
|
103
124
|
*
|
|
@@ -105,7 +126,7 @@ export declare function compileBlueprintV2(declaration: BlueprintV2Declaration,
|
|
|
105
126
|
* and records where each item came from, which makes unsupported items visible
|
|
106
127
|
* instead of silently dropping them during lowering.
|
|
107
128
|
*/
|
|
108
|
-
export declare function createBlueprintV2ExecutionPlan(declaration: BlueprintV2Declaration): BlueprintV2ExecutionPlan;
|
|
129
|
+
export declare function createBlueprintV2ExecutionPlan(declaration: BlueprintV2Declaration, siteMode?: BlueprintV2SiteMode): BlueprintV2ExecutionPlan;
|
|
109
130
|
/**
|
|
110
131
|
* Converts the supported v2 plan items into v1-compatible step records.
|
|
111
132
|
*
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BlueprintDeclaration, RuntimeConfiguration } from '../types';
|
|
2
|
+
import type { BlueprintV2Declaration } from './blueprint-v2-declaration';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the runtime settings required by a Blueprint v2 declaration.
|
|
5
|
+
*
|
|
6
|
+
* This module owns the v2 support boundary: unsupported declarations and
|
|
7
|
+
* runtime sources are rejected here instead of falling back to v1 behavior.
|
|
8
|
+
* The validation callback runs before any runtime source is resolved.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveBlueprintV2RuntimeConfiguration(declaration: BlueprintDeclaration, siteMode?: BlueprintV2SiteMode, onBlueprintValidated?: (declaration: BlueprintV2Declaration) => void): Promise<RuntimeConfiguration>;
|
|
11
|
+
/** Describes whether Playground creates a site or applies to mounted files. */
|
|
12
|
+
export type BlueprintV2SiteMode = 'create-new-site' | 'apply-to-existing-site';
|
|
13
|
+
/**
|
|
14
|
+
* Verifies that an existing site satisfies its Blueprint v2 WordPress version.
|
|
15
|
+
*
|
|
16
|
+
* Only constraint objects restrict an existing site. Shorthand versions,
|
|
17
|
+
* including `latest` and concrete releases, are new-site selection hints.
|
|
18
|
+
* `preferred` is also a selection hint and does not narrow compatibility.
|
|
19
|
+
*/
|
|
20
|
+
export declare function assertBlueprintV2WordPressVersionCompatibility(declaration: BlueprintV2Declaration, installedVersion: string): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BlueprintValidationResult } from '../v1/compile';
|
|
2
|
+
export type BlueprintV2ValidationError = {
|
|
3
|
+
path: string;
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
export type BlueprintV2ValidationResult = {
|
|
7
|
+
valid: true;
|
|
8
|
+
} | {
|
|
9
|
+
valid: false;
|
|
10
|
+
errors: BlueprintV2ValidationError[];
|
|
11
|
+
};
|
|
12
|
+
/** Validates an unknown value against the complete Blueprint v2 schema. */
|
|
13
|
+
export declare function validateBlueprintV2(blueprintMaybe: unknown): BlueprintV2ValidationResult;
|
|
14
|
+
/** Returns actionable AJV errors with location data for editors and tooling. */
|
|
15
|
+
export declare function validateBlueprintV2Declaration(blueprintMaybe: unknown): BlueprintValidationResult;
|
|
16
|
+
/** Rejects an invalid value before any Blueprint v2 runtime work begins. */
|
|
17
|
+
export declare function assertValidBlueprintV2Declaration(blueprintMaybe: unknown): void;
|
|
@@ -30,9 +30,9 @@ export declare namespace V2Schema {
|
|
|
30
30
|
* for declaring options or opinions for different application contexts.
|
|
31
31
|
*
|
|
32
32
|
* To keep Blueprints portable and focused on site creation, this specification
|
|
33
|
-
* only allows
|
|
34
|
-
* additional options. Future versions of this specification may
|
|
35
|
-
* options – they will be discussed on a case-by-case basis.
|
|
33
|
+
* only allows a small set of Playground-specific options. Other environments
|
|
34
|
+
* cannot declare additional options. Future versions of this specification may
|
|
35
|
+
* allow additional options – they will be discussed on a case-by-case basis.
|
|
36
36
|
*/
|
|
37
37
|
applicationOptions?: {
|
|
38
38
|
/**
|
|
@@ -62,8 +62,53 @@ export declare namespace V2Schema {
|
|
|
62
62
|
* @default false
|
|
63
63
|
*/
|
|
64
64
|
networkAccess?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Optional PHP extensions to load in the Playground runtime before executing
|
|
67
|
+
* the Blueprint. Extensions omitted from this list are not disabled.
|
|
68
|
+
*/
|
|
69
|
+
loadPhpExtensions?: Array<'intl'>;
|
|
65
70
|
};
|
|
66
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* The content from a vanilla WordPress installation to retain before
|
|
74
|
+
* applying the rest of the Blueprint. `keep-all` leaves the installation
|
|
75
|
+
* unchanged, `empty` removes its posts, pages, and comments, a content type
|
|
76
|
+
* retains only that type, and a list retains the selected content types.
|
|
77
|
+
*
|
|
78
|
+
* This policy runs only when the current invocation creates vanilla
|
|
79
|
+
* WordPress. It is skipped when applying the Blueprint to an existing site,
|
|
80
|
+
* so it cannot erase content from that site. It is not valid when
|
|
81
|
+
* `wordpressVersion` is "none". Metadata and relationships follow their
|
|
82
|
+
* parent content. Empty content tables have their sequences reset so
|
|
83
|
+
* subsequent imports receive the identifiers they would on a site created
|
|
84
|
+
* without default content.
|
|
85
|
+
*
|
|
86
|
+
* Comments can only be retained together with both posts and pages because
|
|
87
|
+
* the schema cannot know which type contains their parent records.
|
|
88
|
+
*
|
|
89
|
+
* @default "keep-all"
|
|
90
|
+
*/
|
|
91
|
+
contentBaseline?: 'keep-all' | 'empty' | Exclude<ContentType, 'comments'> | [ContentType, ...ContentType[]];
|
|
92
|
+
/**
|
|
93
|
+
* The users from a vanilla WordPress installation to retain before applying
|
|
94
|
+
* the rest of the Blueprint. `keep-all` retains the administrator created by
|
|
95
|
+
* WordPress, while `empty` removes it before creating the users declared by
|
|
96
|
+
* this Blueprint.
|
|
97
|
+
*
|
|
98
|
+
* Empty user tables have their sequences reset before those users are
|
|
99
|
+
* created.
|
|
100
|
+
*
|
|
101
|
+
* An empty user baseline requires an empty content baseline so removing the
|
|
102
|
+
* installation administrator cannot silently delete or orphan authored
|
|
103
|
+
* content. It also requires at least one declared administrator, ensuring
|
|
104
|
+
* the resulting WordPress site remains manageable.
|
|
105
|
+
*
|
|
106
|
+
* Like `contentBaseline`, this policy is skipped when applying the Blueprint
|
|
107
|
+
* to an existing site and is not valid when `wordpressVersion` is "none".
|
|
108
|
+
*
|
|
109
|
+
* @default "keep-all"
|
|
110
|
+
*/
|
|
111
|
+
usersBaseline?: 'keep-all' | 'empty';
|
|
67
112
|
/**
|
|
68
113
|
* SITE OPTIONS {{{
|
|
69
114
|
*
|
|
@@ -146,17 +191,21 @@ export declare namespace V2Schema {
|
|
|
146
191
|
*/
|
|
147
192
|
constants?: WordPressConstants;
|
|
148
193
|
/**
|
|
149
|
-
* WordPress version to install.
|
|
194
|
+
* WordPress version to install or require.
|
|
195
|
+
*
|
|
196
|
+
* A string selects the version for a newly created site. A branch such as
|
|
197
|
+
* `6.8` selects the newest available release in that branch. Strings are
|
|
198
|
+
* selection hints and do not reject an existing site. `"none"` boots the
|
|
199
|
+
* PHP runtime without downloading WordPress or initializing its database.
|
|
150
200
|
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
201
|
+
* An object declares compatibility bounds. The runner chooses the newest
|
|
202
|
+
* available release within those bounds for a new site and verifies an
|
|
203
|
+
* existing site's installed version against them. `preferred` influences
|
|
204
|
+
* new-site selection without narrowing compatibility.
|
|
154
205
|
*
|
|
155
|
-
*
|
|
156
|
-
* as an integrity check to verify that the currently installed version of
|
|
157
|
-
* WordPress installed on the target site matches the constraint.
|
|
206
|
+
* A data reference supplies the WordPress files for a newly created site.
|
|
158
207
|
*
|
|
159
|
-
* @default "latest"
|
|
208
|
+
* @default "latest"
|
|
160
209
|
*/
|
|
161
210
|
wordpressVersion?: DataSources.WordPressVersion | DataSources.DataReference | {
|
|
162
211
|
min: DataSources.WordPressVersionConstraintVersion;
|
|
@@ -275,6 +324,8 @@ export declare namespace V2Schema {
|
|
|
275
324
|
* throw an error.
|
|
276
325
|
*
|
|
277
326
|
* See https://github.com/WordPress/blueprints-library/issues/32 for more context.
|
|
327
|
+
*
|
|
328
|
+
* @propertyNames { "pattern": "^[a-z0-9_-]{1,20}$" }
|
|
278
329
|
*/
|
|
279
330
|
postTypes?: Record<PostTypeKey, PostType | DataSources.ExecutionContextPath>;
|
|
280
331
|
/**
|
|
@@ -317,7 +368,7 @@ export declare namespace V2Schema {
|
|
|
317
368
|
* }
|
|
318
369
|
* ```
|
|
319
370
|
*/
|
|
320
|
-
fonts?: Record<string, DataSources.
|
|
371
|
+
fonts?: Record<string, DataSources.FileDataReference | FontCollection>;
|
|
321
372
|
/**
|
|
322
373
|
* A list of media files to upload to the WordPress Media Library – in formats
|
|
323
374
|
* supported by the WordPress Media Library.
|
|
@@ -357,6 +408,11 @@ export declare namespace V2Schema {
|
|
|
357
408
|
}>;
|
|
358
409
|
additionalStepsAfterExecution?: Array<Step>;
|
|
359
410
|
};
|
|
411
|
+
/**
|
|
412
|
+
* Content types created by a vanilla WordPress installation and controlled
|
|
413
|
+
* by `contentBaseline`.
|
|
414
|
+
*/
|
|
415
|
+
type ContentType = 'posts' | 'pages' | 'comments';
|
|
360
416
|
type LicenseKeyword = 'AFL-3.0' | 'Apache-2.0' | 'Artistic-2.0' | 'BSL-1.0' | 'BSD-2-Clause' | 'BSD-3-Clause' | 'BSD-3-Clause-Clear' | 'BSD-4-Clause' | '0BSD' | 'CC' | 'CC0-1.0' | 'CC-BY-4.0' | 'CC-BY-SA-4.0' | 'WTFPL' | 'ECL-2.0' | 'EPL-1.0' | 'EPL-2.0' | 'EUPL-1.1' | 'AGPL-3.0' | 'GPL' | 'GPL-2.0' | 'GPL-3.0' | 'LGPL' | 'LGPL-2.1' | 'LGPL-3.0' | 'ISC' | 'LPPL-1.3c' | 'MS-PL' | 'MIT' | 'MPL-2.0' | 'OSL-3.0' | 'PostgreSQL' | 'OFL-1.1' | 'NCSA' | 'Unlicense' | 'Zlib';
|
|
361
417
|
type URLMappingConfig = {
|
|
362
418
|
/**
|
|
@@ -373,15 +429,17 @@ export declare namespace V2Schema {
|
|
|
373
429
|
urlsMode?: 'rewrite' | 'preserve';
|
|
374
430
|
/**
|
|
375
431
|
* A mapping of base URLs to rewrite.
|
|
432
|
+
*
|
|
433
|
+
* @propertyNames { "$ref": "#/definitions/DataSources.URLReference" }
|
|
376
434
|
*/
|
|
377
435
|
urlsMap?: Record<DataSources.URLReference, DataSources.URLReference>;
|
|
378
436
|
};
|
|
379
|
-
type ContentDefinition =
|
|
437
|
+
type ContentDefinition = {
|
|
380
438
|
type: 'mysql-dump';
|
|
381
439
|
source: DataSources.FileDataReference | DataSources.FileDataReference[];
|
|
382
|
-
}
|
|
440
|
+
} | ({
|
|
383
441
|
type: 'posts';
|
|
384
|
-
source: DataSources.FileDataReference | DataSources.FileDataReference
|
|
442
|
+
source: DataSources.FileDataReference | WordPressPost | (DataSources.FileDataReference | WordPressPost)[];
|
|
385
443
|
} & URLMappingConfig)
|
|
386
444
|
/**
|
|
387
445
|
* WXR files to import.
|
|
@@ -532,6 +590,8 @@ export declare namespace V2Schema {
|
|
|
532
590
|
/**
|
|
533
591
|
* An explicit directory name within wp-content/plugins to install the plugin at.
|
|
534
592
|
* If not provided, it will be inferred from the plugin source.
|
|
593
|
+
*
|
|
594
|
+
* @pattern ^(?!(?:\.|\.\.)$)[^/]+$
|
|
535
595
|
*/
|
|
536
596
|
targetDirectoryName?: string;
|
|
537
597
|
/**
|
|
@@ -584,6 +644,8 @@ export declare namespace V2Schema {
|
|
|
584
644
|
/**
|
|
585
645
|
* An explicit directory name within wp-content/themes to install the theme at.
|
|
586
646
|
* If not provided, it will be inferred from the theme source.
|
|
647
|
+
*
|
|
648
|
+
* @pattern ^(?!(?:\.|\.\.)$)[^/]+$
|
|
587
649
|
*/
|
|
588
650
|
targetDirectoryName?: string;
|
|
589
651
|
/**
|
|
@@ -1063,7 +1125,7 @@ export declare namespace V2Schema {
|
|
|
1063
1125
|
/** CSS font-display value. */
|
|
1064
1126
|
fontDisplay?: 'auto' | 'block' | 'fallback' | 'swap' | 'optional';
|
|
1065
1127
|
/** Paths or URLs to the font files. */
|
|
1066
|
-
src: DataSources.
|
|
1128
|
+
src: DataSources.FileDataReference | DataSources.FileDataReference[];
|
|
1067
1129
|
/** CSS font-stretch value. */
|
|
1068
1130
|
fontStretch?: string;
|
|
1069
1131
|
/** CSS ascent-override value. */
|
|
@@ -1315,6 +1377,10 @@ export declare namespace V2Schema {
|
|
|
1315
1377
|
step: 'defineConstants';
|
|
1316
1378
|
constants: WordPressConstants;
|
|
1317
1379
|
};
|
|
1380
|
+
type EnableMultisiteStep = {
|
|
1381
|
+
/** Converts the target WordPress installation into a multisite network. */
|
|
1382
|
+
step: 'enableMultisite';
|
|
1383
|
+
};
|
|
1318
1384
|
type ImportContentStep = {
|
|
1319
1385
|
step: 'importContent';
|
|
1320
1386
|
content: ContentDefinition[];
|
|
@@ -1347,6 +1413,14 @@ export declare namespace V2Schema {
|
|
|
1347
1413
|
step: 'rmdir';
|
|
1348
1414
|
path: string;
|
|
1349
1415
|
};
|
|
1416
|
+
type ResetDataStep = {
|
|
1417
|
+
step: 'resetData';
|
|
1418
|
+
/**
|
|
1419
|
+
* Content types to remove. When omitted, all posts, pages, custom post
|
|
1420
|
+
* types, and comments are removed.
|
|
1421
|
+
*/
|
|
1422
|
+
contentTypes?: Array<ContentType>;
|
|
1423
|
+
};
|
|
1350
1424
|
type RunPHPStep = {
|
|
1351
1425
|
step: 'runPHP';
|
|
1352
1426
|
/**
|
|
@@ -1417,7 +1491,7 @@ export declare namespace V2Schema {
|
|
|
1417
1491
|
*/
|
|
1418
1492
|
active?: boolean;
|
|
1419
1493
|
} & ThemeObjectDefinition;
|
|
1420
|
-
type Step = ActivatePluginStep | ActivateThemeStep | CpStep | DefineConstantsStep | ImportContentStep | ImportMediaStep | ImportThemeStarterContentStep | PluginStep | ThemeStep | MkdirStep | MvStep | RmStep | RmdirStep | RunPHPStep | RunSQLStep | SetSiteLanguageStep | SetSiteOptionsStep | UnzipStep | WpCliStep | WriteFilesStep;
|
|
1494
|
+
type Step = ActivatePluginStep | ActivateThemeStep | CpStep | DefineConstantsStep | EnableMultisiteStep | ImportContentStep | ImportMediaStep | ImportThemeStarterContentStep | PluginStep | ThemeStep | MkdirStep | MvStep | RmStep | RmdirStep | ResetDataStep | RunPHPStep | RunSQLStep | SetSiteLanguageStep | SetSiteOptionsStep | UnzipStep | WpCliStep | WriteFilesStep;
|
|
1421
1495
|
type JsonValue = string | boolean | number | JsonValue[] | {
|
|
1422
1496
|
[key: string]: JsonValue;
|
|
1423
1497
|
};
|
|
@@ -12,6 +12,8 @@ export declare namespace DataSources {
|
|
|
12
12
|
* optionally contain usernames and passwords if needed.
|
|
13
13
|
*
|
|
14
14
|
* @see https://url.spec.whatwg.org/
|
|
15
|
+
* @asType string
|
|
16
|
+
* @pattern ^[Hh][Tt][Tt][Pp][Ss]?://[^/?#]+
|
|
15
17
|
*/
|
|
16
18
|
export type URLReference = `http://${string}` | `https://${string}`;
|
|
17
19
|
/**
|
|
@@ -27,6 +29,9 @@ export declare namespace DataSources {
|
|
|
27
29
|
* still the directory where blueprint.json is located.
|
|
28
30
|
*
|
|
29
31
|
* It is not possible to escape the Blueprint Execution Context via "../" sequences.
|
|
32
|
+
*
|
|
33
|
+
* @asType string
|
|
34
|
+
* @pattern ^(?!.*(?:^|/)\.\.(?:/|$))(?:\./|/).*$
|
|
30
35
|
*/
|
|
31
36
|
export type ExecutionContextPath = `/${string}` | `./${string}`;
|
|
32
37
|
/**
|
|
@@ -42,6 +47,7 @@ export declare namespace DataSources {
|
|
|
42
47
|
* ```
|
|
43
48
|
*/
|
|
44
49
|
export type InlineFile = {
|
|
50
|
+
/** @pattern ^(?!(?:\.|\.\.)$)[^/]+$ */
|
|
45
51
|
filename: string;
|
|
46
52
|
content: InlineFileContent;
|
|
47
53
|
};
|
|
@@ -66,7 +72,9 @@ export declare namespace DataSources {
|
|
|
66
72
|
* ```
|
|
67
73
|
*/
|
|
68
74
|
export type InlineDirectory = {
|
|
75
|
+
/** @pattern ^(?!(?:\.|\.\.)$)[^/]+$ */
|
|
69
76
|
directoryName: string;
|
|
77
|
+
/** @propertyNames { "pattern": "^(?!(?:\\.|\\.\\.)$)[^/]+$" } */
|
|
70
78
|
files: Record<string, InlineFileContent | NestedInlineDirectory>;
|
|
71
79
|
};
|
|
72
80
|
/**
|
|
@@ -75,6 +83,7 @@ export declare namespace DataSources {
|
|
|
75
83
|
* Its directory name comes from the parent `files` record key.
|
|
76
84
|
*/
|
|
77
85
|
export type NestedInlineDirectory = {
|
|
86
|
+
/** @propertyNames { "pattern": "^(?!(?:\\.|\\.\\.)$)[^/]+$" } */
|
|
78
87
|
files: Record<string, InlineFileContent | NestedInlineDirectory>;
|
|
79
88
|
};
|
|
80
89
|
/**
|
|
@@ -95,6 +104,8 @@ export declare namespace DataSources {
|
|
|
95
104
|
* A path inside the git repository this data reference points to.
|
|
96
105
|
*
|
|
97
106
|
* Defaults to the root of the repository.
|
|
107
|
+
*
|
|
108
|
+
* @pattern ^(?!.*(?:^|/)\.\.(?:/|$)).*$
|
|
98
109
|
*/
|
|
99
110
|
pathInRepository?: string;
|
|
100
111
|
};
|
|
@@ -105,7 +116,7 @@ export declare namespace DataSources {
|
|
|
105
116
|
/**
|
|
106
117
|
* A data reference that must resolve to a single file.
|
|
107
118
|
*/
|
|
108
|
-
export type FileDataReference = URLReference | ExecutionContextPath | InlineFile;
|
|
119
|
+
export type FileDataReference = URLReference | ExecutionContextPath | TargetSitePath | InlineFile;
|
|
109
120
|
/**
|
|
110
121
|
* }}}
|
|
111
122
|
*/
|
|
@@ -117,24 +128,39 @@ export declare namespace DataSources {
|
|
|
117
128
|
*/
|
|
118
129
|
/** Helper types {{{ */
|
|
119
130
|
/**
|
|
120
|
-
* A
|
|
121
|
-
*
|
|
122
|
-
* ```
|
|
123
|
-
* ^[a-zA-Z0-9_-]+$
|
|
124
|
-
* ```
|
|
131
|
+
* A WordPress.org directory slug.
|
|
125
132
|
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* string matching the above regex.
|
|
133
|
+
* Slugs are intentionally treated as opaque strings. Playground should not
|
|
134
|
+
* reject future WordPress.org slug formats just because they do not match the
|
|
135
|
+
* directory conventions common today.
|
|
130
136
|
*/
|
|
131
137
|
export type Slug = string;
|
|
138
|
+
/**
|
|
139
|
+
* @asType string
|
|
140
|
+
* @pattern ^(?:latest|\d+\.\d+(?:\.\d+)?)$
|
|
141
|
+
*/
|
|
132
142
|
export type SimpleVersionExpression = 'latest' | `${number}.${number}` | `${number}.${number}.${number}`;
|
|
133
143
|
export type VersionNumberComponent = `${bigint}`;
|
|
144
|
+
/**
|
|
145
|
+
* @asType string
|
|
146
|
+
* @pattern ^\d+\.\d+(?:\.\d+)?$
|
|
147
|
+
*/
|
|
134
148
|
export type ComparableVersionExpression = `${VersionNumberComponent}.${VersionNumberComponent}` | `${VersionNumberComponent}.${VersionNumberComponent}.${VersionNumberComponent}`;
|
|
135
149
|
export type WordPressVersionSuffix = `beta${VersionNumberComponent}` | `rc${VersionNumberComponent}`;
|
|
150
|
+
/**
|
|
151
|
+
* @asType string
|
|
152
|
+
* @pattern ^\d+\.\d+(?:\.\d+)?(?:-(?:beta\d+|[Rr][Cc]\d+))?$
|
|
153
|
+
*/
|
|
136
154
|
export type WordPressVersionConstraintVersion = ComparableVersionExpression | `${ComparableVersionExpression}-${WordPressVersionSuffix}`;
|
|
155
|
+
/**
|
|
156
|
+
* @asType string
|
|
157
|
+
* @pattern ^(?:latest|\d+\.\d+(?:\.\d+)?(?:-(?:beta\d+|[Rr][Cc]\d+))?)$
|
|
158
|
+
*/
|
|
137
159
|
export type WordPressVersionPreferredVersion = 'latest' | WordPressVersionConstraintVersion;
|
|
160
|
+
/**
|
|
161
|
+
* @asType string
|
|
162
|
+
* @pattern ^(?:latest|\d+\.\d+(?:\.\d+)?)$
|
|
163
|
+
*/
|
|
138
164
|
export type PHPVersionConstraintVersion = SimpleVersionExpression;
|
|
139
165
|
/** }}} Helper types */
|
|
140
166
|
/**
|
|
@@ -166,16 +192,21 @@ export declare namespace DataSources {
|
|
|
166
192
|
*/
|
|
167
193
|
export type ThemeDirectoryReference = Slug | `${Slug}@${SimpleVersionExpression}`;
|
|
168
194
|
/**
|
|
169
|
-
* WordPress version, e.g. "latest", "beta", "trunk", "6.4",
|
|
195
|
+
* WordPress version, e.g. "latest", "beta", "trunk", "none", "6.4",
|
|
170
196
|
* "6.4.3", "6.8-RC1", or "6.7-beta2".
|
|
171
197
|
*
|
|
172
198
|
* These refer to slugs of specific WordPress releases as listed in
|
|
173
199
|
* the first table column on https://wordpress.org/download/releases/.
|
|
200
|
+
* "none" is not a release. It means the Blueprint runs PHP without
|
|
201
|
+
* installing WordPress.
|
|
174
202
|
*
|
|
175
203
|
* The WordPressVersion type is only meaningful in the top-level
|
|
176
204
|
* `wordpressVersion` property.
|
|
205
|
+
*
|
|
206
|
+
* @asType string
|
|
207
|
+
* @pattern ^(?:latest|beta|trunk|nightly|none|\d+\.\d+(?:\.\d+)?(?:-(?:beta\d+|[Rr][Cc]\d+))?)$
|
|
177
208
|
*/
|
|
178
|
-
export type WordPressVersion = 'beta' | 'trunk' | 'nightly' | SimpleVersionExpression | `${SimpleVersionExpression}-${WordPressVersionSuffix}`;
|
|
209
|
+
export type WordPressVersion = 'none' | 'beta' | 'trunk' | 'nightly' | SimpleVersionExpression | `${SimpleVersionExpression}-${WordPressVersionSuffix}`;
|
|
179
210
|
/**
|
|
180
211
|
* PHP version, e.g. "8.1", "8.1.3", or "next".
|
|
181
212
|
*
|
|
@@ -185,14 +216,22 @@ export declare namespace DataSources {
|
|
|
185
216
|
*
|
|
186
217
|
* The PHPVersion type is only meaningful in the top-level
|
|
187
218
|
* `phpVersion` property.
|
|
219
|
+
*
|
|
220
|
+
* @asType string
|
|
221
|
+
* @pattern ^(?:latest|next|\d+\.\d+(?:\.\d+)?)$
|
|
188
222
|
*/
|
|
189
223
|
export type PHPVersion = SimpleVersionExpression | 'next';
|
|
190
224
|
/**
|
|
191
|
-
* A path within the
|
|
225
|
+
* A path within the target WordPress site, relative to the WordPress root
|
|
192
226
|
* directory. For example, site:wp-content/uploads/2024/01/image.jpg.
|
|
193
227
|
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
228
|
+
* Unlike an execution-context path, this path is resolved from the mutable
|
|
229
|
+
* target filesystem when the consuming step runs. Earlier steps may therefore
|
|
230
|
+
* create the referenced file. The runner must keep the path inside the target
|
|
231
|
+
* WordPress root; it never names a file on the host filesystem.
|
|
232
|
+
*
|
|
233
|
+
* @asType string
|
|
234
|
+
* @pattern ^site:(?!\/*$)(?!\.\.(?:/|$))(?!.*\/\.\.(?:/|$)).+$
|
|
196
235
|
*/
|
|
197
236
|
export type TargetSitePath = `site:${string}`;
|
|
198
237
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type BlueprintValidationResult } from './v1/compile';
|
|
2
|
+
/**
|
|
3
|
+
* Validates either Blueprint declaration version without loading the v2
|
|
4
|
+
* validator for v1 declarations.
|
|
5
|
+
*/
|
|
6
|
+
export declare function validateBlueprintDeclaration(blueprintMaybe: unknown): Promise<BlueprintValidationResult>;
|