@wp-playground/blueprints 3.1.43 → 3.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.
Files changed (40) hide show
  1. package/blueprint-schema-validator.d.ts +4 -1
  2. package/blueprint-schema-validator.js +2814 -1768
  3. package/blueprint-schema.json +3110 -1
  4. package/blueprint-v2-schema-validator.d.ts +5 -0
  5. package/blueprint-v2-schema-validator.js +37821 -0
  6. package/index.cjs +1044 -150
  7. package/index.cjs.map +1 -1
  8. package/index.d.ts +9 -4
  9. package/index.js +7853 -4819
  10. package/index.js.map +1 -1
  11. package/lib/compile.d.ts +32 -0
  12. package/lib/invalid-blueprint-error.d.ts +5 -0
  13. package/lib/is-git-repo-url.d.ts +8 -0
  14. package/lib/reflection.d.ts +1 -1
  15. package/lib/resolve-runtime-configuration.d.ts +13 -1
  16. package/lib/steps/import-wxr.d.ts +44 -0
  17. package/lib/steps/install-plugin.d.ts +12 -0
  18. package/lib/steps/install-theme.d.ts +9 -0
  19. package/lib/steps/reset-data.d.ts +9 -2
  20. package/lib/v1/compile.d.ts +3 -5
  21. package/lib/v2/blueprint-v2-declaration.d.ts +0 -10
  22. package/lib/v2/compile.d.ts +138 -0
  23. package/lib/v2/resolve-runtime-configuration.d.ts +20 -0
  24. package/lib/v2/validate-blueprint-v2.d.ts +17 -0
  25. package/lib/v2/wep-1-blueprint-v2-schema/appendix-A-blueprint-v2-schema.d.ts +202 -103
  26. package/lib/v2/wep-1-blueprint-v2-schema/appendix-B-data-sources.d.ts +77 -18
  27. package/lib/validate-blueprint-declaration.d.ts +6 -0
  28. package/package.json +11 -11
  29. package/schema-readme.md +6 -5
  30. package/tests/v2/schema-conformance-fixtures.d.ts +2033 -0
  31. package/validate-blueprint-v2-C3rgpKFU.js +17393 -0
  32. package/validate-blueprint-v2-C3rgpKFU.js.map +1 -0
  33. package/validate-blueprint-v2-CJ8Xbxyz.cjs +201 -0
  34. package/validate-blueprint-v2-CJ8Xbxyz.cjs.map +1 -0
  35. package/blueprints-Gs5fAvvo.cjs +0 -2
  36. package/blueprints-Gs5fAvvo.cjs.map +0 -1
  37. package/blueprints-pMn3V9MZ.js +0 -5
  38. package/blueprints-pMn3V9MZ.js.map +0 -1
  39. package/lib/v2/get-v2-runner.d.ts +0 -1
  40. package/lib/v2/run-blueprint-v2.d.ts +0 -36
@@ -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,8 +72,19 @@ export declare namespace DataSources {
66
72
  * ```
67
73
  */
68
74
  export type InlineDirectory = {
75
+ /** @pattern ^(?!(?:\.|\.\.)$)[^/]+$ */
69
76
  directoryName: string;
70
- files: Record<string, InlineFileContent | InlineDirectory>;
77
+ /** @propertyNames { "pattern": "^(?!(?:\\.|\\.\\.)$)[^/]+$" } */
78
+ files: Record<string, InlineFileContent | NestedInlineDirectory>;
79
+ };
80
+ /**
81
+ * A child directory inside an inline directory.
82
+ *
83
+ * Its directory name comes from the parent `files` record key.
84
+ */
85
+ export type NestedInlineDirectory = {
86
+ /** @propertyNames { "pattern": "^(?!(?:\\.|\\.\\.)$)[^/]+$" } */
87
+ files: Record<string, InlineFileContent | NestedInlineDirectory>;
71
88
  };
72
89
  /**
73
90
  * A reference to a remote git repository.
@@ -87,6 +104,8 @@ export declare namespace DataSources {
87
104
  * A path inside the git repository this data reference points to.
88
105
  *
89
106
  * Defaults to the root of the repository.
107
+ *
108
+ * @pattern ^(?!.*(?:^|/)\.\.(?:/|$)).*$
90
109
  */
91
110
  pathInRepository?: string;
92
111
  };
@@ -94,6 +113,10 @@ export declare namespace DataSources {
94
113
  * A union of all general data reference types.
95
114
  */
96
115
  export type DataReference = URLReference | ExecutionContextPath | InlineFile | InlineDirectory | GitPath;
116
+ /**
117
+ * A data reference that must resolve to a single file.
118
+ */
119
+ export type FileDataReference = URLReference | ExecutionContextPath | TargetSitePath | InlineFile;
97
120
  /**
98
121
  * }}}
99
122
  */
@@ -105,20 +128,40 @@ export declare namespace DataSources {
105
128
  */
106
129
  /** Helper types {{{ */
107
130
  /**
108
- * A slug is a string matching the following regex:
109
- *
110
- * ```
111
- * ^[a-zA-Z0-9_-]+$
112
- * ```
131
+ * A WordPress.org directory slug.
113
132
  *
114
- * This constraint may be expressed in TypeScript, but it would come at the
115
- * expense of readability. This document will thus alias the general `string`
116
- * type to `Slug`. Every reference to the `Slug` type should be treated as a
117
- * 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.
118
136
  */
119
137
  export type Slug = string;
138
+ /**
139
+ * @asType string
140
+ * @pattern ^(?:latest|\d+\.\d+(?:\.\d+)?)$
141
+ */
120
142
  export type SimpleVersionExpression = 'latest' | `${number}.${number}` | `${number}.${number}.${number}`;
121
- export type WordPressVersionSuffix = `beta${number}` | `rc${number}`;
143
+ export type VersionNumberComponent = `${bigint}`;
144
+ /**
145
+ * @asType string
146
+ * @pattern ^\d+\.\d+(?:\.\d+)?$
147
+ */
148
+ export type ComparableVersionExpression = `${VersionNumberComponent}.${VersionNumberComponent}` | `${VersionNumberComponent}.${VersionNumberComponent}.${VersionNumberComponent}`;
149
+ export type WordPressVersionSuffix = `beta${VersionNumberComponent}` | `rc${VersionNumberComponent}`;
150
+ /**
151
+ * @asType string
152
+ * @pattern ^\d+\.\d+(?:\.\d+)?(?:-(?:beta\d+|[Rr][Cc]\d+))?$
153
+ */
154
+ export type WordPressVersionConstraintVersion = ComparableVersionExpression | `${ComparableVersionExpression}-${WordPressVersionSuffix}`;
155
+ /**
156
+ * @asType string
157
+ * @pattern ^(?:latest|\d+\.\d+(?:\.\d+)?(?:-(?:beta\d+|[Rr][Cc]\d+))?)$
158
+ */
159
+ export type WordPressVersionPreferredVersion = 'latest' | WordPressVersionConstraintVersion;
160
+ /**
161
+ * @asType string
162
+ * @pattern ^(?:latest|\d+\.\d+(?:\.\d+)?)$
163
+ */
164
+ export type PHPVersionConstraintVersion = SimpleVersionExpression;
122
165
  /** }}} Helper types */
123
166
  /**
124
167
  * Plugin directory reference, e.g. "jetpack", "jetpack@6.4", or "akismet@6.4.3".
@@ -149,30 +192,46 @@ export declare namespace DataSources {
149
192
  */
150
193
  export type ThemeDirectoryReference = Slug | `${Slug}@${SimpleVersionExpression}`;
151
194
  /**
152
- * WordPress version, e.g. "6.4", "6.4.3", "6.8-RC1", or "6.7-beta2".
195
+ * WordPress version, e.g. "latest", "beta", "trunk", "none", "6.4",
196
+ * "6.4.3", "6.8-RC1", or "6.7-beta2".
153
197
  *
154
198
  * These refer to slugs of specific WordPress releases as listed in
155
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.
156
202
  *
157
203
  * The WordPressVersion type is only meaningful in the top-level
158
204
  * `wordpressVersion` property.
205
+ *
206
+ * @asType string
207
+ * @pattern ^(?:latest|beta|trunk|nightly|none|\d+\.\d+(?:\.\d+)?(?:-(?:beta\d+|[Rr][Cc]\d+))?)$
159
208
  */
160
- export type WordPressVersion = SimpleVersionExpression | `${SimpleVersionExpression}-${WordPressVersionSuffix}`;
209
+ export type WordPressVersion = 'none' | 'beta' | 'trunk' | 'nightly' | SimpleVersionExpression | `${SimpleVersionExpression}-${WordPressVersionSuffix}`;
161
210
  /**
162
- * PHP version, e.g. "8.1" or "8.1.3".
211
+ * PHP version, e.g. "8.1", "8.1.3", or "next".
163
212
  *
164
213
  * These refer to PHP versions as listed in https://www.php.net/releases/.
214
+ * `next` previews the php-src development branch and is currently
215
+ * supported by the web runtime only.
165
216
  *
166
217
  * The PHPVersion type is only meaningful in the top-level
167
218
  * `phpVersion` property.
219
+ *
220
+ * @asType string
221
+ * @pattern ^(?:latest|next|\d+\.\d+(?:\.\d+)?)$
168
222
  */
169
- export type PHPVersion = SimpleVersionExpression;
223
+ export type PHPVersion = SimpleVersionExpression | 'next';
170
224
  /**
171
- * A path within the built WordPress site, relative to the WordPress root
225
+ * A path within the target WordPress site, relative to the WordPress root
172
226
  * directory. For example, site:wp-content/uploads/2024/01/image.jpg.
173
227
  *
174
- * This type is only meaningful in imperative Blueprint steps for operations
175
- * such as creating new files or moving files and directories.
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:(?!\/*$)(?!\.\.(?:/|$))(?!.*\/\.\.(?:/|$)).+$
176
235
  */
177
236
  export type TargetSitePath = `site:${string}`;
178
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-playground/blueprints",
3
- "version": "3.1.43",
3
+ "version": "3.1.45",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./index.js",
@@ -25,22 +25,22 @@
25
25
  "access": "public",
26
26
  "directory": "../../../dist/packages/playground/blueprints"
27
27
  },
28
- "gitHead": "7cc9b0e4e673406ca2d1eaf9cbcb40fdb86563fe",
28
+ "gitHead": "d8132e032daf7c1ac2fd568af48444d84a59ced2",
29
29
  "engines": {
30
30
  "node": ">=20.10.0",
31
31
  "npm": ">=10.2.3"
32
32
  },
33
33
  "dependencies": {
34
34
  "ajv": "8.18.0",
35
- "@wp-playground/storage": "3.1.43",
36
- "@php-wasm/util": "3.1.43",
37
- "@wp-playground/common": "3.1.43",
38
- "@php-wasm/logger": "3.1.43",
39
- "@php-wasm/universal": "3.1.43",
40
- "@wp-playground/wordpress": "3.1.43",
41
- "@php-wasm/progress": "3.1.43",
42
- "@php-wasm/web-service-worker": "3.1.43",
43
- "@php-wasm/stream-compression": "3.1.43"
35
+ "@php-wasm/universal": "3.1.45",
36
+ "@wp-playground/storage": "3.1.45",
37
+ "@php-wasm/util": "3.1.45",
38
+ "@php-wasm/logger": "3.1.45",
39
+ "@wp-playground/wordpress": "3.1.45",
40
+ "@php-wasm/progress": "3.1.45",
41
+ "@wp-playground/common": "3.1.45",
42
+ "@php-wasm/web-service-worker": "3.1.45",
43
+ "@php-wasm/stream-compression": "3.1.45"
44
44
  },
45
45
  "packageManager": "npm@10.9.2",
46
46
  "overrides": {
package/schema-readme.md CHANGED
@@ -1,10 +1,11 @@
1
- The JSON schema stored in this directory describes how to validate
2
- the Blueprints and is autogenerated from the Blueprints TypeScript types.
1
+ The public JSON schema stored in this directory describes both Blueprint
2
+ declaration versions and is autogenerated from the Blueprint TypeScript types.
3
3
 
4
- The Blueprint schema validator stored in this directory is used to validate
5
- Blueprints and is autogenerated from the Blueprints JSON schema.
4
+ The existing `blueprint-schema-validator.js` remains the v1 runtime validator.
5
+ Blueprint v2 has its own validator, so adding one version cannot silently
6
+ change validation of the other.
6
7
 
7
- Whenever the types are modified, the schema and validator need to be
8
+ Whenever the types are modified, the schemas and validators need to be
8
9
  rebuilt using `nx build playground-blueprints` and then committed to
9
10
  the repository.
10
11