@bedrock-core/builder 0.1.2 → 0.3.0

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 (56) hide show
  1. package/CHANGELOG.md +84 -1
  2. package/dist/bin/api-library.d.ts +1 -0
  3. package/dist/bin/api-library.js +10 -0
  4. package/dist/bin/audit-paths.d.ts +1 -0
  5. package/dist/bin/audit-paths.js +44 -0
  6. package/dist/bin/build.js +1 -1
  7. package/dist/bin/builder.js +13 -2
  8. package/dist/bin/migrate.js +1 -15
  9. package/dist/bin/plan.js +2 -2
  10. package/dist/bin/watch.js +1 -1
  11. package/dist/package.json +12 -10
  12. package/dist/schemas/bundler.schema.json +5 -0
  13. package/dist/schemas/config.schema.json +40 -10
  14. package/dist/schemas/generator.schema.json +11 -29
  15. package/dist/schemas/guides.schema.json +0 -5
  16. package/dist/schemas/i18n.schema.json +0 -5
  17. package/dist/schemas/pack-manifest.schema.json +294 -0
  18. package/dist/schemas/ui-compiler.schema.json +0 -15
  19. package/dist/src/config.d.ts +21 -7
  20. package/dist/src/config.js +3 -0
  21. package/dist/src/contract.d.ts +5 -2
  22. package/dist/src/export.d.ts +7 -5
  23. package/dist/src/export.js +274 -47
  24. package/dist/src/migrate.d.ts +1 -1
  25. package/dist/src/migrate.js +23 -17
  26. package/dist/src/migration/exports.js +1 -1
  27. package/dist/src/migration/filters.d.ts +4 -7
  28. package/dist/src/migration/filters.js +41 -234
  29. package/dist/src/migration/project.d.ts +1 -2
  30. package/dist/src/migration/project.js +35 -25
  31. package/dist/src/migration/types.d.ts +1 -8
  32. package/dist/src/path-audit.d.ts +29 -0
  33. package/dist/src/path-audit.js +110 -0
  34. package/dist/src/plan.d.ts +1 -0
  35. package/dist/src/plan.js +7 -7
  36. package/dist/src/plugin-routing.js +1 -1
  37. package/dist/src/plugins.js +10 -1
  38. package/dist/src/project.d.ts +1 -3
  39. package/dist/src/project.js +1 -12
  40. package/dist/src/regolith.d.ts +3 -3
  41. package/dist/src/regolith.js +26 -4
  42. package/dist/src/run.js +86 -38
  43. package/dist/src/staging.d.ts +4 -0
  44. package/dist/src/staging.js +305 -0
  45. package/dist/src/validation.d.ts +1 -1
  46. package/dist/src/watch.js +48 -29
  47. package/package.json +41 -20
  48. package/schemas/bundler.schema.json +5 -0
  49. package/schemas/config.schema.json +40 -10
  50. package/schemas/generator.schema.json +11 -29
  51. package/schemas/guides.schema.json +0 -5
  52. package/schemas/i18n.schema.json +0 -5
  53. package/schemas/pack-manifest.schema.json +294 -0
  54. package/schemas/ui-compiler.schema.json +0 -15
  55. package/dist/src/migration/local-filter.d.ts +0 -3
  56. package/dist/src/migration/local-filter.js +0 -20
@@ -3,9 +3,13 @@
3
3
  "title": "@bedrock-core project configuration",
4
4
  "description": "Minecraft Bedrock project metadata and @bedrock-core profiles.",
5
5
  "type": "object",
6
+ "not": {
7
+ "required": [
8
+ "namespace"
9
+ ]
10
+ },
6
11
  "required": [
7
12
  "targetVersion",
8
- "namespace",
9
13
  "name",
10
14
  "authors",
11
15
  "packs",
@@ -19,13 +23,6 @@
19
23
  "targetVersion": {
20
24
  "$ref": "#/definitions/nonempty"
21
25
  },
22
- "namespace": {
23
- "type": "string",
24
- "pattern": "^[a-z0-9_]+$",
25
- "not": {
26
- "const": "minecraft"
27
- }
28
- },
29
26
  "name": {
30
27
  "$ref": "#/definitions/nonempty"
31
28
  },
@@ -124,6 +121,12 @@
124
121
  "type": "object",
125
122
  "additionalProperties": false,
126
123
  "properties": {
124
+ "include": {
125
+ "type": "array",
126
+ "uniqueItems": true,
127
+ "items": { "$ref": "#/definitions/nonempty" },
128
+ "description": "Additional literal project-relative files or directories copied into staging and observed by watch mode, including plugin data read without imports."
129
+ },
127
130
  "exclude": {
128
131
  "type": "array",
129
132
  "uniqueItems": true,
@@ -198,14 +201,19 @@
198
201
  {
199
202
  "type": "object",
200
203
  "additionalProperties": false,
201
- "required": [
202
- "script"
204
+ "oneOf": [
205
+ { "required": ["script"] },
206
+ { "required": ["nodeModule"] }
203
207
  ],
204
208
  "properties": {
205
209
  "script": {
206
210
  "$ref": "#/definitions/nonempty",
207
211
  "description": "Standalone Node entry point, relative to filterDir, using the Regolith BP/RP/data contract."
208
212
  },
213
+ "nodeModule": {
214
+ "$ref": "#/definitions/nonempty",
215
+ "description": "Installed Node package or exported subpath resolved from filterDir and executed in the BP/RP/data workspace."
216
+ },
209
217
  "filterDir": {
210
218
  "$ref": "#/definitions/nonempty",
211
219
  "description": "Script definition directory, relative to config.json. Defaults to the project root and sets FILTER_DIR."
@@ -418,6 +426,28 @@
418
426
  "type": "boolean",
419
427
  "default": true,
420
428
  "description": "Reuse deterministic compiler output when its inputs match. Set false to rebuild it."
429
+ },
430
+ "validation": {
431
+ "enum": ["strict", "warn", "skip"],
432
+ "default": "warn",
433
+ "description": "Document type validation mode. JSON syntax and pack manifests are always checked."
434
+ },
435
+ "creatorToolsValidation": {
436
+ "enum": ["strict", "warn", "skip"],
437
+ "default": "skip",
438
+ "description": "Run the installed Mojang Creator Tools CLI on the final pack set. In strict mode, errors prevent export."
439
+ },
440
+ "api": {
441
+ "description": "Portable addon API package output; defaults to dist/api when public addon exports are declared. Set false to disable.",
442
+ "anyOf": [
443
+ {
444
+ "const": false
445
+ },
446
+ {
447
+ "type": "string",
448
+ "pattern": "\\S"
449
+ }
450
+ ]
421
451
  }
422
452
  }
423
453
  },
@@ -14,33 +14,6 @@
14
14
  "exclude": {
15
15
  "$ref": "#/$defs/patterns"
16
16
  },
17
- "types": {
18
- "type": "boolean",
19
- "default": true,
20
- "description": "Generate Minecraft schema declarations for editor completion."
21
- },
22
- "schemaVersion": {
23
- "type": "string",
24
- "pattern": "\\S",
25
- "default": "latest"
26
- },
27
- "typesDir": {
28
- "type": ["string", "null"],
29
- "description": "Project-relative declaration output directory; defaults to .bedrock-core/generated/mc."
30
- },
31
- "typePrefix": {
32
- "type": "string",
33
- "default": ""
34
- },
35
- "strict": {
36
- "type": "boolean",
37
- "default": false
38
- },
39
- "maxAgeHours": {
40
- "type": "number",
41
- "minimum": 0,
42
- "default": 24
43
- },
44
17
  "tsconfig": {
45
18
  "type": "string",
46
19
  "pattern": "\\S"
@@ -80,8 +53,17 @@
80
53
  "$defs": {
81
54
  "patterns": {
82
55
  "anyOf": [
83
- { "type": "string", "pattern": "\\S" },
84
- { "type": "array", "items": { "type": "string", "pattern": "\\S" } }
56
+ {
57
+ "type": "string",
58
+ "pattern": "\\S"
59
+ },
60
+ {
61
+ "type": "array",
62
+ "items": {
63
+ "type": "string",
64
+ "pattern": "\\S"
65
+ }
66
+ }
85
67
  ]
86
68
  }
87
69
  }
@@ -8,11 +8,6 @@
8
8
  "type": "boolean",
9
9
  "description": "Stage override for the profile debug setting."
10
10
  },
11
- "namespace": {
12
- "type": "string",
13
- "pattern": "^[a-z0-9_]+$",
14
- "description": "Overrides the project namespace for guide keys."
15
- },
16
11
  "sourceDir": {
17
12
  "type": "string",
18
13
  "minLength": 1,
@@ -19,11 +19,6 @@
19
19
  "pattern": "^[a-z]{2}_[A-Z]{2}$",
20
20
  "default": "en_US"
21
21
  },
22
- "namespace": {
23
- "type": "string",
24
- "pattern": "^[a-z0-9_]+$",
25
- "description": "Defaults to the project's namespace."
26
- },
27
22
  "strict": {
28
23
  "type": "boolean",
29
24
  "default": true
@@ -0,0 +1,294 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "@bedrock-core authored pack manifest",
4
+ "description": "Native manifest v3 fields, inheritance and pack-owned addon metadata.",
5
+ "type": "object",
6
+ "if": {
7
+ "not": {
8
+ "required": [
9
+ "extends"
10
+ ]
11
+ }
12
+ },
13
+ "then": {
14
+ "required": [
15
+ "format_version",
16
+ "header",
17
+ "modules"
18
+ ]
19
+ },
20
+ "properties": {
21
+ "$schema": {
22
+ "type": "string"
23
+ },
24
+ "extends": {
25
+ "type": "string",
26
+ "pattern": "^\\.\\.?[/\\\\]"
27
+ },
28
+ "format_version": {
29
+ "const": 3
30
+ },
31
+ "namespace": {
32
+ "$ref": "#/definitions/namespace"
33
+ },
34
+ "thumbnail": {
35
+ "type": "string",
36
+ "minLength": 1,
37
+ "description": "PNG path relative to the behavior pack or its selected resource pack."
38
+ },
39
+ "optionalDependencies": {
40
+ "type": "array",
41
+ "uniqueItems": true,
42
+ "items": {
43
+ "$ref": "#/definitions/dependency"
44
+ },
45
+ "description": "Optional dependencies use the same authored objects as required dependencies and add no native load requirement."
46
+ },
47
+ "header": {
48
+ "type": "object",
49
+ "properties": {
50
+ "name": {
51
+ "type": "string",
52
+ "minLength": 1
53
+ },
54
+ "description": {
55
+ "type": "string"
56
+ },
57
+ "uuid": {
58
+ "$ref": "#/definitions/uuid"
59
+ },
60
+ "version": {
61
+ "type": "string",
62
+ "minLength": 1
63
+ },
64
+ "min_engine_version": {
65
+ "type": "string",
66
+ "minLength": 1
67
+ },
68
+ "base_game_version": {
69
+ "type": "string"
70
+ },
71
+ "pack_optimization_version": {
72
+ "type": "string"
73
+ },
74
+ "allow_random_seed": {
75
+ "type": "boolean"
76
+ },
77
+ "lock_template_options": {
78
+ "type": "boolean"
79
+ },
80
+ "platform_locked": {
81
+ "type": "boolean"
82
+ },
83
+ "pack_scope": {
84
+ "enum": [
85
+ "world",
86
+ "global",
87
+ "any"
88
+ ]
89
+ }
90
+ }
91
+ },
92
+ "metadata": {
93
+ "type": "object",
94
+ "properties": {
95
+ "authors": {
96
+ "type": "array",
97
+ "items": {
98
+ "type": "string",
99
+ "minLength": 1
100
+ }
101
+ },
102
+ "license": {
103
+ "type": "string"
104
+ },
105
+ "url": {
106
+ "type": "string"
107
+ },
108
+ "product_type": {
109
+ "type": "string"
110
+ },
111
+ "generated_with": {
112
+ "type": "object",
113
+ "additionalProperties": {
114
+ "$ref": "#/definitions/stringList"
115
+ }
116
+ }
117
+ }
118
+ },
119
+ "modules": {
120
+ "type": "array",
121
+ "minItems": 1,
122
+ "items": {
123
+ "type": "object",
124
+ "required": [
125
+ "type",
126
+ "uuid"
127
+ ],
128
+ "properties": {
129
+ "type": {
130
+ "enum": [
131
+ "data",
132
+ "resources",
133
+ "script",
134
+ "world_template",
135
+ "skin_pack"
136
+ ]
137
+ },
138
+ "uuid": {
139
+ "$ref": "#/definitions/uuid"
140
+ },
141
+ "version": {
142
+ "type": "string",
143
+ "minLength": 1
144
+ },
145
+ "description": {
146
+ "type": "string"
147
+ },
148
+ "language": {
149
+ "const": "javascript"
150
+ },
151
+ "entry": {
152
+ "type": "string",
153
+ "pattern": "^scripts/.+\\.(js|ts|tsx|mts|cts)$",
154
+ "description": "Authored script path. Builder compiles TypeScript entries and exports the corresponding .js path."
155
+ }
156
+ }
157
+ }
158
+ },
159
+ "dependencies": {
160
+ "type": "array",
161
+ "items": {
162
+ "$ref": "#/definitions/dependency"
163
+ }
164
+ },
165
+ "capabilities": {
166
+ "$ref": "#/definitions/stringList"
167
+ },
168
+ "has_education_metadata": {
169
+ "type": "boolean"
170
+ },
171
+ "subpacks": {
172
+ "type": "array",
173
+ "items": {
174
+ "type": "object",
175
+ "required": ["folder_name", "name", "memory_performance_tier"],
176
+ "properties": {
177
+ "folder_name": { "type": "string" },
178
+ "name": { "type": "string" },
179
+ "memory_performance_tier": { "type": "integer", "minimum": 0, "maximum": 5 }
180
+ }
181
+ }
182
+ }
183
+ },
184
+ "definitions": {
185
+ "stringList": {
186
+ "type": "array",
187
+ "items": { "type": "string" }
188
+ },
189
+ "namespace": {
190
+ "type": "string",
191
+ "pattern": "^[a-z0-9_]+$",
192
+ "not": {
193
+ "const": "minecraft"
194
+ }
195
+ },
196
+ "uuid": {
197
+ "type": "string",
198
+ "pattern": "^[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$"
199
+ },
200
+ "dependency": {
201
+ "type": "object",
202
+ "not": {
203
+ "anyOf": [
204
+ {
205
+ "required": [
206
+ "pack"
207
+ ]
208
+ },
209
+ {
210
+ "required": [
211
+ "module"
212
+ ]
213
+ }
214
+ ]
215
+ },
216
+ "properties": {
217
+ "uuid": {
218
+ "$ref": "#/definitions/uuid"
219
+ },
220
+ "namespace": {
221
+ "$ref": "#/definitions/namespace"
222
+ },
223
+ "module_name": {
224
+ "type": "string",
225
+ "minLength": 1
226
+ },
227
+ "optional": {
228
+ "type": "boolean"
229
+ },
230
+ "version": {
231
+ "type": "string",
232
+ "minLength": 1
233
+ }
234
+ },
235
+ "if": { "required": ["optional"] },
236
+ "then": { "required": ["module_name"] },
237
+ "oneOf": [
238
+ {
239
+ "required": [
240
+ "namespace"
241
+ ],
242
+ "not": {
243
+ "anyOf": [
244
+ {
245
+ "required": [
246
+ "uuid"
247
+ ]
248
+ },
249
+ {
250
+ "required": [
251
+ "module_name"
252
+ ]
253
+ }
254
+ ]
255
+ }
256
+ },
257
+ {
258
+ "required": [
259
+ "uuid"
260
+ ],
261
+ "not": {
262
+ "required": [
263
+ "module_name"
264
+ ]
265
+ }
266
+ },
267
+ {
268
+ "required": [
269
+ "module_name"
270
+ ],
271
+ "not": {
272
+ "required": [
273
+ "uuid"
274
+ ]
275
+ },
276
+ "if": {
277
+ "properties": {
278
+ "module_name": {
279
+ "pattern": "^@minecraft/"
280
+ }
281
+ }
282
+ },
283
+ "then": {
284
+ "not": {
285
+ "required": [
286
+ "namespace"
287
+ ]
288
+ }
289
+ }
290
+ }
291
+ ]
292
+ }
293
+ }
294
+ }
@@ -4,25 +4,10 @@
4
4
  "type": "object",
5
5
  "additionalProperties": false,
6
6
  "properties": {
7
- "experimentalOre": {
8
- "type": "object",
9
- "additionalProperties": false,
10
- "description": "Asset preparation for Experimental_OreUI screens; ignored when the build has none.",
11
- "properties": {
12
- "clientRoot": { "type": "string", "pattern": "\\S", "description": "Windows Minecraft Content directory; defaults to a matching installed client." },
13
- "resourceRoots": { "type": "array", "items": { "type": "string", "pattern": "\\S" }, "description": "Fallback resource-pack roots after the selected RP, in priority order. Paths resolve from the project." },
14
- "dynamicTextures": { "type": "array", "uniqueItems": true, "items": { "type": "string", "pattern": "^textures/(?:[A-Za-z0-9_-]+/)*[A-Za-z0-9_-]+(?:\\.png)?$" }, "description": "Pack-local PNG textures available to live Ore images." }
15
- }
16
- },
17
7
  "debug": {
18
8
  "type": "boolean",
19
9
  "description": "Stage override for the profile debug setting."
20
10
  },
21
- "namespace": {
22
- "type": "string",
23
- "pattern": "^[a-z0-9_]+$",
24
- "description": "Defaults to the project namespace."
25
- },
26
11
  "testMetadata": {
27
12
  "type": "boolean",
28
13
  "default": false
@@ -1,3 +0,0 @@
1
- import type { FilterKind } from './types.ts';
2
- /** Recognize canonical wrapper files in an explicitly trusted checkout without executing them. */
3
- export declare function localFilterKind(script: string, directory: string): Promise<FilterKind | undefined>;
@@ -1,20 +0,0 @@
1
- import { realpath } from 'node:fs/promises';
2
- import path from 'node:path';
3
- import { stages } from "../plan.js";
4
- /** Recognize canonical wrapper files in an explicitly trusted checkout without executing them. */
5
- export async function localFilterKind(script, directory) {
6
- const canonical = await realpath(script);
7
- for (const stage of ['core', ...stages]) {
8
- try {
9
- const expected = await realpath(path.join(directory, stage, 'main.ts'));
10
- if (path.relative(expected, canonical) === '') {
11
- return stage;
12
- }
13
- }
14
- catch (error) {
15
- if (error.code !== 'ENOENT') {
16
- throw error;
17
- }
18
- }
19
- }
20
- }