@bedrock-core/builder 0.1.1 → 0.2.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 (46) hide show
  1. package/CHANGELOG.md +56 -0
  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 +2 -6
  9. package/dist/bin/plan.js +2 -2
  10. package/dist/bin/watch.js +1 -1
  11. package/dist/package.json +11 -10
  12. package/dist/schemas/config.schema.json +28 -8
  13. package/dist/schemas/guides.schema.json +0 -5
  14. package/dist/schemas/i18n.schema.json +0 -5
  15. package/dist/schemas/pack-manifest.schema.json +243 -0
  16. package/dist/schemas/ui-compiler.schema.json +0 -5
  17. package/dist/src/config.d.ts +7 -3
  18. package/dist/src/config.js +3 -0
  19. package/dist/src/contract.d.ts +2 -0
  20. package/dist/src/export.d.ts +7 -5
  21. package/dist/src/export.js +274 -47
  22. package/dist/src/migrate.js +13 -10
  23. package/dist/src/migration/exports.js +1 -1
  24. package/dist/src/migration/filters.js +3 -2
  25. package/dist/src/migration/local-filter.js +1 -1
  26. package/dist/src/migration/project.js +17 -8
  27. package/dist/src/migration/types.d.ts +0 -2
  28. package/dist/src/path-audit.d.ts +29 -0
  29. package/dist/src/path-audit.js +110 -0
  30. package/dist/src/plan.js +2 -2
  31. package/dist/src/plugin-routing.js +1 -1
  32. package/dist/src/plugins.js +10 -1
  33. package/dist/src/project.d.ts +1 -3
  34. package/dist/src/project.js +1 -12
  35. package/dist/src/regolith.js +2 -2
  36. package/dist/src/run.js +67 -30
  37. package/dist/src/staging.d.ts +4 -0
  38. package/dist/src/staging.js +297 -0
  39. package/dist/src/validation.d.ts +1 -1
  40. package/dist/src/watch.js +48 -20
  41. package/package.json +24 -14
  42. package/schemas/config.schema.json +28 -8
  43. package/schemas/guides.schema.json +0 -5
  44. package/schemas/i18n.schema.json +0 -5
  45. package/schemas/pack-manifest.schema.json +243 -0
  46. package/schemas/ui-compiler.schema.json +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
1
1
  # @bedrock-core/builder
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 930de95: Add producer-owned artifact finalization after plugin hooks and source exclusions, before final pack validation.
8
+
9
+ Refresh UI metadata hashes against final exported files and preserve stable script-entry provenance for shaped application screens.
10
+ - 930de95: Generate portable checked wrappers for reusable API declaration factories and support recursive plain JSON contracts.
11
+ - 930de95: Own addon namespaces and metadata in authored manifests, resolve native addon dependencies, prepare pack artwork and client display aliases, and expose an authored-manifest editor schema.
12
+
13
+ Generate typed clients from public addon package exports and bind provider APIs in their owning behavior packs without evaluating or bundling provider implementations in consumers.
14
+ - 930de95: Require script manifest entries to name their authored source files and publish TypeScript entries as JavaScript paths. Report missing sources and conflicting outputs in build diagnostics.
15
+
16
+ Configure content schema validation as strict, warn, or skip while retaining manifest and JSON syntax checks. Validate sound definitions with bare paths and named sound objects.
17
+ - 930de95: Generate native component, inventory and value contracts from public SDK types. Trace eligible provider and dependency lookups with native TypeScript analysis and preserve tracing requirements in portable API packages.
18
+ - 930de95: Require Node.js 26.13.0 or newer for Builder packages, the CLI, and new projects.
19
+
20
+ Use TypeScript 7.1 for Builder's source analysis, declaration emission, and release compilation. New script and full projects use TypeScript 7.1 for typechecking and retain a compatible compiler for ESLint.
21
+ - 930de95: Generate API object metadata for explicit registration and project writable sources into read-only consumer declarations.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [930de95]
26
+ - Updated dependencies [930de95]
27
+ - Updated dependencies [930de95]
28
+ - Updated dependencies [930de95]
29
+ - Updated dependencies [930de95]
30
+ - Updated dependencies [930de95]
31
+ - Updated dependencies [930de95]
32
+ - Updated dependencies [930de95]
33
+ - Updated dependencies [930de95]
34
+ - Updated dependencies [930de95]
35
+ - Updated dependencies [930de95]
36
+ - Updated dependencies [930de95]
37
+ - Updated dependencies [930de95]
38
+ - Updated dependencies [930de95]
39
+ - Updated dependencies [930de95]
40
+ - @bedrock-core/builder-ui@0.3.0
41
+ - @bedrock-core/builder-i18n@0.2.0
42
+ - @bedrock-core/builder-plugin@0.2.0
43
+ - @bedrock-core/builder-bundler@0.2.0
44
+ - @bedrock-core/builder-manifest@0.2.0
45
+ - @bedrock-core/builder-guides@0.2.0
46
+ - @bedrock-core/builder-validation@0.2.0
47
+ - @bedrock-core/builder-generator@0.2.0
48
+
49
+ ## 0.1.2
50
+
51
+ ### Patch Changes
52
+
53
+ - 3098e57: Register container text positions even when the screen has no appearance variants so runtime inventory allocation matches the compiled layout.
54
+
55
+ Classify runtime text dependencies from JSX expressions and Core text factory calls in both compilation and runtime bundles, while retaining baked literal captions.
56
+ - Updated dependencies [3098e57]
57
+ - @bedrock-core/builder-ui@0.2.1
58
+
3
59
  ## 0.1.1
4
60
 
5
61
  ### Patch Changes
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import path from 'node:path';
2
+ import { emitApiLibrary } from '@bedrock-core/builder-bundler';
3
+ const [entry, output, root = process.cwd()] = process.argv.slice(2);
4
+ if (!entry || !output || entry === '--help' || entry === '-h') {
5
+ console.log('bc-builder api-library <entry.ts> <output.generated.ts> [package-root]');
6
+ }
7
+ else {
8
+ const result = await emitApiLibrary({ root: path.resolve(root), entry, output });
9
+ console.log(`Generated ${result.output}`);
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,44 @@
1
+ import { parseArgs } from 'node:util';
2
+ import { auditPackPaths } from '../src/path-audit.js';
3
+ const usage = `Usage: bc-builder audit-paths <pack-or-add-on-directory> [--max-length 100] [--creator NAME --pack NAME]
4
+
5
+ Report advisory path length, directory depth and cooperative asset-folder findings as JSON.
6
+ Pass a pack root or an unpacked add-on directory containing behavior_packs or resource_packs.
7
+ Use --creator and --pack together to check the exact asset-folder names.
8
+ Use --max-length to select a shorter path budget such as 80.`;
9
+ try {
10
+ const { values, positionals } = parseArgs({
11
+ allowPositionals: true,
12
+ options: {
13
+ 'help': { type: 'boolean', short: 'h' },
14
+ 'max-length': { type: 'string', default: '100' },
15
+ 'creator': { type: 'string' },
16
+ 'pack': { type: 'string' },
17
+ },
18
+ });
19
+ if (values.help) {
20
+ console.log(usage);
21
+ }
22
+ else {
23
+ if (positionals.length !== 1) {
24
+ throw new Error(usage);
25
+ }
26
+ const maxLength = Number(values['max-length']);
27
+ if (!/^\d+$/.test(values['max-length']) || !Number.isSafeInteger(maxLength) || maxLength < 1) {
28
+ throw new Error('--max-length must be a positive integer');
29
+ }
30
+ const { creator, pack } = values;
31
+ if (creator !== undefined || pack !== undefined) {
32
+ const slug = /^[a-z0-9_-]+$/;
33
+ if (!creator || !pack || !slug.test(creator) || !slug.test(pack)) {
34
+ throw new Error('--creator and --pack must be specified together as lowercase folder names using letters, digits, underscores or hyphens');
35
+ }
36
+ }
37
+ const report = await auditPackPaths(positionals[0], { maxLength, folders: creator && pack ? { creator, pack } : undefined });
38
+ console.log(JSON.stringify(report, null, 2));
39
+ }
40
+ }
41
+ catch (error) {
42
+ console.error(error instanceof Error ? error.message : String(error));
43
+ process.exitCode = 1;
44
+ }
package/dist/bin/build.js CHANGED
@@ -1,4 +1,4 @@
1
- import { runBuild } from "../src/run.js";
1
+ import { runBuild } from '../src/run.js';
2
2
  const cancellation = new AbortController();
3
3
  process.once('SIGINT', () => cancellation.abort(new Error('Build cancelled')));
4
4
  try {
@@ -1,16 +1,27 @@
1
1
  #!/usr/bin/env node
2
- var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx, extraExtensions, ignoreCase) {
3
3
  if (typeof path === "string" && /^\.\.?\//.test(path)) {
4
+ if (extraExtensions) {
5
+ for (var extension in extraExtensions) {
6
+ var suffix = path.slice(-extension.length);
7
+ if (suffix === extension || ignoreCase && suffix.toLowerCase() === extension.toLowerCase()) {
8
+ var output = extraExtensions[extension];
9
+ return output === extension ? path : path.slice(0, -extension.length) + output;
10
+ }
11
+ }
12
+ }
4
13
  return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
5
14
  return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
6
15
  });
7
16
  }
8
17
  return path;
9
18
  };
10
- const commands = ['build', 'watch', 'plan', 'migrate'];
19
+ const commands = ['build', 'watch', 'plan', 'migrate', 'audit-paths', 'api-library'];
11
20
  const command = process.argv[2];
12
21
  if (!command || command === '--help' || command === '-h') {
13
22
  console.log('@bedrock-core/builder: bc-builder <build|watch|plan|migrate> [config.json] [profile]');
23
+ console.log('@bedrock-core/builder: bc-builder audit-paths <pack-or-add-on-directory> [--help]');
24
+ console.log('@bedrock-core/builder: bc-builder api-library <entry.ts> <output.generated.ts> [package-root]');
14
25
  }
15
26
  else if (!commands.includes(command)) {
16
27
  console.error(`Unknown builder command: ${command}`);
@@ -1,5 +1,5 @@
1
- import { migrateRegolithProject, writeMigration } from "../src/migrate.js";
2
- import { stages } from "../src/plan.js";
1
+ import { migrateRegolithProject, writeMigration } from '../src/migrate.js';
2
+ import { stages } from '../src/plan.js';
3
3
  const help = `@bedrock-core Regolith configuration migration
4
4
 
5
5
  Usage: bc-builder migrate [config.json] [options]
@@ -9,7 +9,6 @@ Preview is the default. Filters, shell commands and expressions are never execut
9
9
  --write Write a complete migration; save an in-place backup
10
10
  --output path With --write, create a new config beside the original
11
11
  --profile name Select a profile (repeatable; default: all)
12
- --namespace value Supply missing project namespace
13
12
  --target-version value Supply missing targetVersion
14
13
  --export profile:pack=path Set exact destinations (repeat for every pack)
15
14
  --filter id=stage Map a verified local filter or fork to a stage or core
@@ -42,9 +41,6 @@ try {
42
41
  else if (flag === '--json') {
43
42
  json = true;
44
43
  }
45
- else if (flag === '--namespace') {
46
- options.namespace = argument(index++);
47
- }
48
44
  else if (flag === '--target-version') {
49
45
  options.targetVersion = argument(index++);
50
46
  }
package/dist/bin/plan.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { resolve } from 'node:path';
3
- import { planBuild } from "../src/plan.js";
4
- import { validateConfig } from "../src/config.js";
3
+ import { planBuild } from '../src/plan.js';
4
+ import { validateConfig } from '../src/config.js';
5
5
  try {
6
6
  const config = JSON.parse(await readFile(resolve(process.argv[2] ?? 'config.json'), 'utf8'));
7
7
  console.log(JSON.stringify(planBuild(validateConfig(config), process.argv[3] ?? 'default'), null, 2));
package/dist/bin/watch.js CHANGED
@@ -1,4 +1,4 @@
1
- import { watchBuild } from "../src/watch.js";
1
+ import { watchBuild } from '../src/watch.js';
2
2
  const cancellation = new AbortController();
3
3
  process.once('SIGINT', () => cancellation.abort());
4
4
  process.once('SIGTERM', () => cancellation.abort());
package/dist/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "@bedrock-core/builder",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "@bedrock-core/builder-bundler": "0.1.0",
7
- "@bedrock-core/builder-generator": "0.1.0",
8
- "@bedrock-core/builder-guides": "0.1.1",
9
- "@bedrock-core/builder-i18n": "0.1.0",
10
- "@bedrock-core/builder-manifest": "0.1.0",
11
- "@bedrock-core/builder-plugin": "0.1.0",
12
- "@bedrock-core/builder-ui": "0.2.0",
13
- "@bedrock-core/builder-validation": "0.1.1",
6
+ "@bedrock-core/builder-bundler": "0.2.0",
7
+ "@bedrock-core/builder-generator": "0.2.0",
8
+ "@bedrock-core/builder-guides": "0.2.0",
9
+ "@bedrock-core/builder-i18n": "0.2.0",
10
+ "@bedrock-core/builder-manifest": "0.2.0",
11
+ "@bedrock-core/builder-plugin": "0.2.0",
12
+ "@bedrock-core/builder-ui": "0.3.0",
13
+ "@bedrock-core/builder-validation": "0.2.0",
14
14
  "@types/node": "25.9.9",
15
- "ajv": "8.17.1"
15
+ "ajv": "8.17.1",
16
+ "typescript-native": "npm:typescript@7.1.0-beta"
16
17
  }
17
18
  }
@@ -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,
@@ -418,6 +421,23 @@
418
421
  "type": "boolean",
419
422
  "default": true,
420
423
  "description": "Reuse deterministic compiler output when its inputs match. Set false to rebuild it."
424
+ },
425
+ "validation": {
426
+ "enum": ["strict", "warn", "skip"],
427
+ "default": "warn",
428
+ "description": "Content schema validation mode. JSON syntax and pack manifests are always checked."
429
+ },
430
+ "api": {
431
+ "description": "Portable addon API package output; defaults to dist/api when public addon exports are declared. Set false to disable.",
432
+ "anyOf": [
433
+ {
434
+ "const": false
435
+ },
436
+ {
437
+ "type": "string",
438
+ "pattern": "\\S"
439
+ }
440
+ ]
421
441
  }
422
442
  }
423
443
  },
@@ -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,243 @@
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
+ "pack_scope": {
69
+ "enum": [
70
+ "world",
71
+ "global",
72
+ "any"
73
+ ]
74
+ }
75
+ }
76
+ },
77
+ "metadata": {
78
+ "type": "object",
79
+ "properties": {
80
+ "authors": {
81
+ "type": "array",
82
+ "items": {
83
+ "type": "string",
84
+ "minLength": 1
85
+ }
86
+ },
87
+ "license": {
88
+ "type": "string"
89
+ },
90
+ "url": {
91
+ "type": "string"
92
+ },
93
+ "generated_with": {
94
+ "type": "object"
95
+ }
96
+ }
97
+ },
98
+ "modules": {
99
+ "type": "array",
100
+ "minItems": 1,
101
+ "items": {
102
+ "type": "object",
103
+ "required": [
104
+ "type",
105
+ "uuid"
106
+ ],
107
+ "properties": {
108
+ "type": {
109
+ "enum": [
110
+ "data",
111
+ "resources",
112
+ "script",
113
+ "world_template",
114
+ "skin_pack"
115
+ ]
116
+ },
117
+ "uuid": {
118
+ "$ref": "#/definitions/uuid"
119
+ },
120
+ "version": {
121
+ "type": "string",
122
+ "minLength": 1
123
+ },
124
+ "language": {
125
+ "const": "javascript"
126
+ },
127
+ "entry": {
128
+ "type": "string",
129
+ "pattern": "^scripts/.+\\.(js|ts|tsx|mts|cts)$",
130
+ "description": "Authored script path. Builder compiles TypeScript entries and exports the corresponding .js path."
131
+ }
132
+ }
133
+ }
134
+ },
135
+ "dependencies": {
136
+ "type": "array",
137
+ "items": {
138
+ "$ref": "#/definitions/dependency"
139
+ }
140
+ }
141
+ },
142
+ "definitions": {
143
+ "namespace": {
144
+ "type": "string",
145
+ "pattern": "^[a-z0-9_]+$",
146
+ "not": {
147
+ "const": "minecraft"
148
+ }
149
+ },
150
+ "uuid": {
151
+ "type": "string",
152
+ "pattern": "^[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$"
153
+ },
154
+ "dependency": {
155
+ "type": "object",
156
+ "not": {
157
+ "anyOf": [
158
+ {
159
+ "required": [
160
+ "pack"
161
+ ]
162
+ },
163
+ {
164
+ "required": [
165
+ "module"
166
+ ]
167
+ }
168
+ ]
169
+ },
170
+ "properties": {
171
+ "uuid": {
172
+ "$ref": "#/definitions/uuid"
173
+ },
174
+ "namespace": {
175
+ "$ref": "#/definitions/namespace"
176
+ },
177
+ "module_name": {
178
+ "type": "string",
179
+ "minLength": 1
180
+ },
181
+ "version": {
182
+ "type": "string",
183
+ "minLength": 1
184
+ }
185
+ },
186
+ "oneOf": [
187
+ {
188
+ "required": [
189
+ "namespace"
190
+ ],
191
+ "not": {
192
+ "anyOf": [
193
+ {
194
+ "required": [
195
+ "uuid"
196
+ ]
197
+ },
198
+ {
199
+ "required": [
200
+ "module_name"
201
+ ]
202
+ }
203
+ ]
204
+ }
205
+ },
206
+ {
207
+ "required": [
208
+ "uuid"
209
+ ],
210
+ "not": {
211
+ "required": [
212
+ "module_name"
213
+ ]
214
+ }
215
+ },
216
+ {
217
+ "required": [
218
+ "module_name"
219
+ ],
220
+ "not": {
221
+ "required": [
222
+ "uuid"
223
+ ]
224
+ },
225
+ "if": {
226
+ "properties": {
227
+ "module_name": {
228
+ "pattern": "^@minecraft/"
229
+ }
230
+ }
231
+ },
232
+ "then": {
233
+ "not": {
234
+ "required": [
235
+ "namespace"
236
+ ]
237
+ }
238
+ }
239
+ }
240
+ ]
241
+ }
242
+ }
243
+ }
@@ -18,11 +18,6 @@
18
18
  "type": "boolean",
19
19
  "description": "Stage override for the profile debug setting."
20
20
  },
21
- "namespace": {
22
- "type": "string",
23
- "pattern": "^[a-z0-9_]+$",
24
- "description": "Defaults to the project namespace."
25
- },
26
21
  "testMetadata": {
27
22
  "type": "boolean",
28
23
  "default": false
@@ -2,6 +2,7 @@ import type { builtinPlugins } from './builtins.ts';
2
2
  export type { JsonFormatting } from '@bedrock-core/builder-plugin';
3
3
  import type { JsonFormatting } from '@bedrock-core/builder-plugin';
4
4
  import type { PackLinkOverrides } from '@bedrock-core/builder-plugin';
5
+ import type { ContentValidationMode } from '@bedrock-core/builder-validation';
5
6
  /** Built-in transformation names, in execution order. */
6
7
  export type StageName = keyof typeof builtinPlugins;
7
8
  /** JSON-compatible options passed unchanged to a stage or module plugin. */
@@ -65,10 +66,14 @@ export interface BuildProfile {
65
66
  stages?: Partial<Record<StageName, StageSelection>>;
66
67
  /** Reuse verified compilation and validation results; defaults to true. */
67
68
  cache?: boolean;
69
+ /** Content schema validation mode; defaults to warn. JSON syntax and pack manifests always validate. */
70
+ validation?: ContentValidationMode;
68
71
  /** Invocations after prepare, before/after enabled stages, or before export. */
69
72
  steps?: PluginStep[];
70
73
  /** Destination for every configured pack ID, relative to config.json or absolute. */
71
74
  export?: Record<string, string>;
75
+ /** Publish declared addon API exports; defaults to dist/api, or false to disable. */
76
+ api?: string | false;
72
77
  /** Debounce interval and additional project-relative inputs for watch mode. */
73
78
  watch?: {
74
79
  debounceMs?: number;
@@ -81,8 +86,6 @@ export interface ProjectConfig {
81
86
  $schema?: string;
82
87
  /** Target Minecraft version used by participating stages. */
83
88
  targetVersion: string;
84
- /** Default namespace for generated content. */
85
- namespace: string;
86
89
  /** Human-readable project name. */
87
90
  name: string;
88
91
  /** Optional project description. */
@@ -98,8 +101,9 @@ export interface ProjectConfig {
98
101
  bedrockCore: {
99
102
  formatVersion: '1.0.0';
100
103
  plugins?: Record<string, PluginDefinition>;
101
- /** Literal project-relative paths omitted from staging and watch mode. */
104
+ /** Extra authored inputs and omitted paths, relative to config.json. */
102
105
  staging?: {
106
+ include?: string[];
103
107
  exclude?: string[];
104
108
  };
105
109
  profiles: Record<string, BuildProfile>;
@@ -34,6 +34,9 @@ export function validatePluginDefinition(definition, name) {
34
34
  * @throws If metadata or builder fields fail schema validation.
35
35
  */
36
36
  export function validateConfig(config) {
37
+ if (config !== null && typeof config === 'object' && Object.hasOwn(config, 'namespace')) {
38
+ throw new Error('Invalid project configuration: declare namespace in each pack manifest.json');
39
+ }
37
40
  if (!validate(config)) {
38
41
  const details = (validate.errors ?? [])
39
42
  .map(error => `${error.instancePath || '/'} ${error.message}`)
@@ -25,6 +25,8 @@ export interface BuildResult {
25
25
  readonly validation: ContentValidationResult;
26
26
  /** Pack IDs mapped to their published absolute directories. */
27
27
  readonly outputPaths: Readonly<Record<string, string>>;
28
+ /** Published portable addon API package, when emitted by the provider build. */
29
+ readonly apiOutput?: string;
28
30
  /** Profile used for the build. */
29
31
  readonly profile: string;
30
32
  /** Participating stage statuses and optional explanations. */