@bedrock-core/builder 0.0.0-stage → 0.1.1

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 (76) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/LICENSE +21 -0
  3. package/README.md +13 -2
  4. package/dist/bin/build.d.ts +1 -0
  5. package/dist/bin/build.js +17 -0
  6. package/dist/bin/builder.d.ts +2 -0
  7. package/dist/bin/builder.js +24 -0
  8. package/dist/bin/migrate.d.ts +1 -0
  9. package/dist/bin/migrate.js +117 -0
  10. package/dist/bin/plan.d.ts +1 -0
  11. package/dist/bin/plan.js +12 -0
  12. package/dist/bin/watch.d.ts +1 -0
  13. package/dist/bin/watch.js +15 -0
  14. package/dist/package.json +17 -0
  15. package/dist/schemas/bundler.schema.json +57 -0
  16. package/dist/schemas/config.schema.json +541 -0
  17. package/dist/schemas/generator.schema.json +88 -0
  18. package/dist/schemas/guides.schema.json +110 -0
  19. package/dist/schemas/i18n.schema.json +94 -0
  20. package/dist/schemas/manifest.schema.json +52 -0
  21. package/dist/schemas/ui-compiler.schema.json +81 -0
  22. package/dist/src/builtins.d.ts +9 -0
  23. package/dist/src/builtins.js +9 -0
  24. package/dist/src/config.d.ts +126 -0
  25. package/dist/src/config.js +44 -0
  26. package/dist/src/contract.d.ts +48 -0
  27. package/dist/src/export.d.ts +47 -0
  28. package/dist/src/export.js +244 -0
  29. package/dist/src/file-cache.d.ts +27 -0
  30. package/dist/src/file-cache.js +350 -0
  31. package/dist/src/manifest.d.ts +1 -0
  32. package/dist/src/manifest.js +1 -0
  33. package/dist/src/migrate.d.ts +12 -0
  34. package/dist/src/migrate.js +138 -0
  35. package/dist/src/migration/exports.d.ts +3 -0
  36. package/dist/src/migration/exports.js +81 -0
  37. package/dist/src/migration/filters.d.ts +7 -0
  38. package/dist/src/migration/filters.js +306 -0
  39. package/dist/src/migration/local-filter.d.ts +3 -0
  40. package/dist/src/migration/local-filter.js +20 -0
  41. package/dist/src/migration/project.d.ts +25 -0
  42. package/dist/src/migration/project.js +137 -0
  43. package/dist/src/migration/types.d.ts +44 -0
  44. package/dist/src/migration/types.js +6 -0
  45. package/dist/src/packs.d.ts +2 -0
  46. package/dist/src/packs.js +1 -0
  47. package/dist/src/plan.d.ts +35 -0
  48. package/dist/src/plan.js +147 -0
  49. package/dist/src/plugin-packs.d.ts +10 -0
  50. package/dist/src/plugin-packs.js +83 -0
  51. package/dist/src/plugin-routing.d.ts +17 -0
  52. package/dist/src/plugin-routing.js +95 -0
  53. package/dist/src/plugins.d.ts +8 -0
  54. package/dist/src/plugins.js +37 -0
  55. package/dist/src/project.d.ts +6 -0
  56. package/dist/src/project.js +72 -0
  57. package/dist/src/regolith.d.ts +11 -0
  58. package/dist/src/regolith.js +338 -0
  59. package/dist/src/run.d.ts +8 -0
  60. package/dist/src/run.js +475 -0
  61. package/dist/src/source-writes.d.ts +10 -0
  62. package/dist/src/source-writes.js +28 -0
  63. package/dist/src/staging.d.ts +4 -0
  64. package/dist/src/staging.js +25 -0
  65. package/dist/src/validation.d.ts +2 -0
  66. package/dist/src/validation.js +1 -0
  67. package/dist/src/watch.d.ts +17 -0
  68. package/dist/src/watch.js +335 -0
  69. package/package.json +171 -3
  70. package/schemas/bundler.schema.json +57 -0
  71. package/schemas/config.schema.json +541 -0
  72. package/schemas/generator.schema.json +88 -0
  73. package/schemas/guides.schema.json +110 -0
  74. package/schemas/i18n.schema.json +94 -0
  75. package/schemas/manifest.schema.json +52 -0
  76. package/schemas/ui-compiler.schema.json +81 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,87 @@
1
+ # @bedrock-core/builder
2
+
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Version Builder stage and plugin packages independently with Changesets and preserve dependency-owned versions in release metadata.
8
+ - Updated dependencies [aed8e9b]
9
+ - Updated dependencies [5116709]
10
+ - Updated dependencies [de16949]
11
+ - Updated dependencies [25c298b]
12
+ - @bedrock-core/builder-validation@0.1.1
13
+ - @bedrock-core/builder-ui@0.2.0
14
+ - @bedrock-core/builder-guides@0.1.1
15
+
16
+ ## 0.1.0
17
+
18
+ ### Minor Changes
19
+
20
+ - c0ffcd9: Exclude configured project paths from staging and watch mode, and reuse validated cache values without an additional JSON round trip.
21
+ - 09203ce: Scaffold full, plain script and resource-only projects with `bc-builder` commands,
22
+ named packs and build, watch and GameTest profiles. Define display metadata and
23
+ the build namespace in configuration, inherit manifest defaults and declare runtime
24
+ registration explicitly in each script pack. Full starters keep
25
+ translations and guides in the owning behavior pack and link resource output through native
26
+ dependencies. Pin the UI toolkit and its render-pack dependency together, including
27
+ the modules resource-pack description in both behavior manifests.
28
+ - 9ff3921: Require an explicit build namespace and keep runtime creator, pack and version
29
+ declarations in each script pack's registration. The generated project module
30
+ provides shared display and package metadata for authored content.
31
+ - 59ca6b9: Select native plugin owners from declared manifest module requirements, with shared pack restrictions and named direct-dependency overrides. Reject ambiguous relationships and conflicting edits to shared pack outputs.
32
+ - 59ca6b9: Run Node scripts against explicit BP/RP folder mappings, with independent data workspaces and optional successful-build data persistence.
33
+ - 9ff3921: Compile guides from each owner pack, with separate generated manifests, typed imports
34
+ and language contributions routed to declared local resource dependencies. Reserve
35
+ guide inputs from template generation and omit them from published packs. Preserve
36
+ independent language sections and reject conflicting keys in shared destinations.
37
+ Keep CLI guide samples inside the behavior pack and resolve builder guide paths
38
+ relative to their owner. Standalone compilation resolves paths from the supplied root.
39
+ - 09203ce: Resolve profile-selected pack graphs and module selectors, route feature output through
40
+ declared local resource dependencies, and generate shared project metadata for manifests
41
+ and authored content. Native manifests inherit project defaults and preserve
42
+ authored pack and module identities. Client translation output requires a
43
+ linked local resource pack; runtime-only translations select `client: false`.
44
+
45
+ Discover locales inside each owner pack, reserve them from template generation and
46
+ omit build sources from publication after consumers finish. Generate distinct per-pack
47
+ runtime imports and declarations, and compose independent language sections in shared
48
+ resource destinations with conflict diagnostics.
49
+ - 09203ce: Expose package-owned `./plugin` entrypoints through the shared build context and
50
+ plugin contracts. Declare public export paths explicitly and keep implementation
51
+ helpers private. Bundler extensions contribute compiler plugins, virtual modules,
52
+ resolution settings and tracked inputs with conservative cache reuse. Standalone
53
+ packages load using their own declared dependencies.
54
+
55
+ ### Patch Changes
56
+
57
+ - 5922b1b: Expose the builder executable as `bc-builder` and use it in generated project scripts.
58
+ - 583575b: Ignore absent export exclusions beneath regular files, preserving imported JSON assets during UI builds. Recognize local migration wrappers by canonical paths within the trusted checkout. Canonicalize temporary workspaces so artifact ownership checks accept Windows short paths and filesystem aliases. Resolve manifest inheritance within the canonical project boundary when the authored root uses a filesystem alias.
59
+ - 59ca6b9: Fill missing manifest license and homepage metadata from the project and record the bedrock-core generator version while preserving authored metadata.
60
+ - 9dfba7a: Keep bundled TypeScript artifacts available through artifact validation and omit their source files from exported packs.
61
+ - Updated dependencies [59ca6b9]
62
+ - Updated dependencies [878fe82]
63
+ - Updated dependencies [9ff3921]
64
+ - Updated dependencies [59ca6b9]
65
+ - Updated dependencies [878fe82]
66
+ - Updated dependencies [878fe82]
67
+ - Updated dependencies [59ca6b9]
68
+ - Updated dependencies [878fe82]
69
+ - Updated dependencies [2a9f1e8]
70
+ - Updated dependencies [9ff3921]
71
+ - Updated dependencies [09203ce]
72
+ - Updated dependencies [583575b]
73
+ - Updated dependencies [59ca6b9]
74
+ - Updated dependencies [878fe82]
75
+ - Updated dependencies [09203ce]
76
+ - Updated dependencies [59ca6b9]
77
+ - Updated dependencies [09203ce]
78
+ - Updated dependencies [2a9f1e8]
79
+ - Updated dependencies [9dfba7a]
80
+ - @bedrock-core/builder-bundler@0.1.0
81
+ - @bedrock-core/builder-ui@0.1.0
82
+ - @bedrock-core/builder-plugin@0.1.0
83
+ - @bedrock-core/builder-generator@0.1.0
84
+ - @bedrock-core/builder-i18n@0.1.0
85
+ - @bedrock-core/builder-manifest@0.1.0
86
+ - @bedrock-core/builder-guides@0.1.0
87
+ - @bedrock-core/builder-validation@0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 @bedrock-core contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,14 @@
1
- # Temporary Holding Version
1
+ # @bedrock-core/builder
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Build tools for Minecraft Bedrock packs, with CLI scaffolding, build stages, plugins, and example projects.
4
+
5
+ https://bedrock-core.drav.dev/docs/builder
6
+
7
+ ## Contributing
8
+
9
+ Open an issue or pull request in this repository. Package maintainers use the
10
+ [release process](docs/releasing.md).
11
+
12
+ ## License
13
+
14
+ [MIT](./LICENSE)
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { runBuild } from "../src/run.js";
2
+ const cancellation = new AbortController();
3
+ process.once('SIGINT', () => cancellation.abort(new Error('Build cancelled')));
4
+ try {
5
+ const result = await runBuild({
6
+ configPath: process.argv[2] ?? 'config.json',
7
+ profile: process.argv[3] ?? 'default',
8
+ signal: cancellation.signal,
9
+ });
10
+ for (const [id, directory] of Object.entries(result.outputPaths)) {
11
+ console.log(`@bedrock-core/builder: exported ${id} to ${directory}`);
12
+ }
13
+ }
14
+ catch (error) {
15
+ console.error(error instanceof Error ? error.message : String(error));
16
+ process.exitCode = 1;
17
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
3
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
4
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
5
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
6
+ });
7
+ }
8
+ return path;
9
+ };
10
+ const commands = ['build', 'watch', 'plan', 'migrate'];
11
+ const command = process.argv[2];
12
+ if (!command || command === '--help' || command === '-h') {
13
+ console.log('@bedrock-core/builder: bc-builder <build|watch|plan|migrate> [config.json] [profile]');
14
+ }
15
+ else if (!commands.includes(command)) {
16
+ console.error(`Unknown builder command: ${command}`);
17
+ process.exitCode = 1;
18
+ }
19
+ else {
20
+ process.argv.splice(2, 1);
21
+ const extension = import.meta.url.endsWith('.ts') ? 'ts' : 'js';
22
+ await import(__rewriteRelativeImportExtension(`./${command}.${extension}`));
23
+ }
24
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,117 @@
1
+ import { migrateRegolithProject, writeMigration } from "../src/migrate.js";
2
+ import { stages } from "../src/plan.js";
3
+ const help = `@bedrock-core Regolith configuration migration
4
+
5
+ Usage: bc-builder migrate [config.json] [options]
6
+
7
+ Preview is the default. Filters, shell commands and expressions are never executed.
8
+
9
+ --write Write a complete migration; save an in-place backup
10
+ --output path With --write, create a new config beside the original
11
+ --profile name Select a profile (repeatable; default: all)
12
+ --namespace value Supply missing project namespace
13
+ --target-version value Supply missing targetVersion
14
+ --export profile:pack=path Set exact destinations (repeat for every pack)
15
+ --filter id=stage Map a verified local filter or fork to a stage or core
16
+ --json Print config, diagnostics and readiness as JSON
17
+ --help Show this help
18
+ `;
19
+ try {
20
+ const args = process.argv.slice(2);
21
+ const options = {};
22
+ let configPath;
23
+ let outputPath;
24
+ let write = false;
25
+ let json = false;
26
+ function argument(index) {
27
+ const value = args[index + 1];
28
+ if (!value || value.startsWith('--')) {
29
+ throw new Error(`Missing value for ${args[index]}`);
30
+ }
31
+ return value;
32
+ }
33
+ for (let index = 0; index < args.length; index++) {
34
+ const flag = args[index];
35
+ if (flag === '--help' || flag === '-h') {
36
+ console.log(help);
37
+ process.exit(0);
38
+ }
39
+ if (flag === '--write') {
40
+ write = true;
41
+ }
42
+ else if (flag === '--json') {
43
+ json = true;
44
+ }
45
+ else if (flag === '--namespace') {
46
+ options.namespace = argument(index++);
47
+ }
48
+ else if (flag === '--target-version') {
49
+ options.targetVersion = argument(index++);
50
+ }
51
+ else if (flag === '--output') {
52
+ outputPath = argument(index++);
53
+ }
54
+ else if (flag === '--profile') {
55
+ options.profiles ??= [];
56
+ options.profiles.push(argument(index++));
57
+ }
58
+ else if (flag === '--export') {
59
+ const value = argument(index++);
60
+ const match = /^([^:=]+):([^:=]+)=(.+)$/.exec(value);
61
+ if (!match) {
62
+ throw new Error('--export expects profile:pack=path');
63
+ }
64
+ const [, profile, pack, directory] = match;
65
+ options.exports = {
66
+ ...options.exports,
67
+ [profile]: { ...options.exports?.[profile], [pack]: directory },
68
+ };
69
+ }
70
+ else if (flag === '--filter') {
71
+ const value = argument(index++);
72
+ const match = /^([^=]+)=([^=]+)$/.exec(value);
73
+ if (!match || (match[2] !== 'core' && !stages.some(stage => stage === match[2]))) {
74
+ throw new Error(`--filter expects id=core or id=${stages.join('|')}`);
75
+ }
76
+ options.filters = { ...options.filters, [match[1]]: match[2] };
77
+ }
78
+ else if (flag.startsWith('-') || configPath !== undefined) {
79
+ throw new Error(`Unknown argument: ${flag}`);
80
+ }
81
+ else {
82
+ configPath = flag;
83
+ }
84
+ }
85
+ if (outputPath !== undefined && !write) {
86
+ throw new Error('--output requires --write; omit both flags for a preview');
87
+ }
88
+ const result = await migrateRegolithProject(configPath, options);
89
+ const written = write && result.ready ? await writeMigration(result, outputPath) : undefined;
90
+ if (json) {
91
+ console.log(JSON.stringify({ config: result.config, diagnostics: result.diagnostics, ready: result.ready, written }, null, 2));
92
+ }
93
+ else {
94
+ for (const diagnostic of result.diagnostics) {
95
+ console.error(`[${diagnostic.severity}] ${diagnostic.code} ${diagnostic.path}: ${diagnostic.message}`);
96
+ }
97
+ if (written) {
98
+ console.log(`@bedrock-core: wrote ${written.path}`);
99
+ if (written.backup) {
100
+ console.log(`@bedrock-core: backup ${written.backup}`);
101
+ }
102
+ }
103
+ else {
104
+ console.log(JSON.stringify(result.config, null, 2));
105
+ console.error(result.ready
106
+ ? '@bedrock-core: migration preview is ready; use --write to save it'
107
+ : '@bedrock-core: migration requires manual changes; no files were written');
108
+ }
109
+ }
110
+ if (!result.ready) {
111
+ process.exitCode = 1;
112
+ }
113
+ }
114
+ catch (error) {
115
+ console.error(error instanceof Error ? error.message : String(error));
116
+ process.exitCode = 1;
117
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { resolve } from 'node:path';
3
+ import { planBuild } from "../src/plan.js";
4
+ import { validateConfig } from "../src/config.js";
5
+ try {
6
+ const config = JSON.parse(await readFile(resolve(process.argv[2] ?? 'config.json'), 'utf8'));
7
+ console.log(JSON.stringify(planBuild(validateConfig(config), process.argv[3] ?? 'default'), null, 2));
8
+ }
9
+ catch (error) {
10
+ console.error(error instanceof Error ? error.message : String(error));
11
+ process.exitCode = 1;
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { watchBuild } from "../src/watch.js";
2
+ const cancellation = new AbortController();
3
+ process.once('SIGINT', () => cancellation.abort());
4
+ process.once('SIGTERM', () => cancellation.abort());
5
+ try {
6
+ await watchBuild({
7
+ configPath: process.argv[2] ?? 'config.json',
8
+ profile: process.argv[3] ?? 'default',
9
+ signal: cancellation.signal,
10
+ });
11
+ }
12
+ catch (error) {
13
+ console.error(error instanceof Error ? error.message : String(error));
14
+ process.exitCode = 1;
15
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@bedrock-core/builder",
3
+ "version": "0.1.1",
4
+ "type": "module",
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",
14
+ "@types/node": "25.9.9",
15
+ "ajv": "8.17.1"
16
+ }
17
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "@bedrock-core bundler settings",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "pretty": {
8
+ "anyOf": [
9
+ {
10
+ "const": false
11
+ },
12
+ {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "properties": {
16
+ "indent": {
17
+ "enum": [
18
+ "tab",
19
+ "space"
20
+ ]
21
+ },
22
+ "size": {
23
+ "type": "integer",
24
+ "minimum": 1
25
+ }
26
+ }
27
+ }
28
+ ]
29
+ },
30
+ "debug": {
31
+ "type": "boolean"
32
+ },
33
+ "target": {
34
+ "type": "string",
35
+ "pattern": "\\S"
36
+ },
37
+ "tsconfig": {
38
+ "type": "string",
39
+ "pattern": "\\S"
40
+ },
41
+ "external": {
42
+ "type": "array",
43
+ "items": {
44
+ "type": "string",
45
+ "pattern": "\\S"
46
+ }
47
+ },
48
+ "generatedImports": {
49
+ "type": "object",
50
+ "description": "Optional overrides or custom artifact aliases. Producer import names resolve automatically.",
51
+ "additionalProperties": {
52
+ "type": "string",
53
+ "pattern": "\\S"
54
+ }
55
+ }
56
+ }
57
+ }