@bedrock-core/builder-validation 0.1.0 → 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.
- package/CHANGELOG.md +21 -15
- package/dist/package.json +1 -1
- package/dist/src/index.js +39 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
# @bedrock-core/builder-validation
|
|
2
|
-
|
|
3
|
-
## 0.1.
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
# @bedrock-core/builder-validation
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- aed8e9b: Validate infinite spell effects, mixed client render-controller entries and numeric geometry vectors against the pinned schema catalog.
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 09203ce: Expose package-owned `./plugin` entrypoints through the shared build context and
|
|
14
|
+
plugin contracts. Declare public export paths explicitly and keep implementation
|
|
15
|
+
helpers private. Bundler extensions contribute compiler plugins, virtual modules,
|
|
16
|
+
resolution settings and tracked inputs with conservative cache reuse. Standalone
|
|
17
|
+
packages load using their own declared dependencies.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 59ca6b9: Accept single terrain texture paths alongside path arrays when validating with the pinned Mojang schema catalog.
|
package/dist/package.json
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -65,6 +65,45 @@ export async function validatePackContent(options) {
|
|
|
65
65
|
const entry = properties.texture_data.additionalProperties;
|
|
66
66
|
entry.properties.textures = { anyOf: [{ type: 'string' }, entry.properties.textures] };
|
|
67
67
|
}
|
|
68
|
+
if (!options.schemaRoot && metadata.version === '1.26.50') {
|
|
69
|
+
if (file === path.join(root, 'schemas/bp/entities/entity_minecraft_spell_effects.schema.json')) {
|
|
70
|
+
// Effects accept numeric seconds or the documented infinite duration.
|
|
71
|
+
// https://learn.microsoft.com/minecraft/creator/reference/content/entityreference/examples/entitycomponents/minecraftcomponent_spell_effects
|
|
72
|
+
const fields = document.properties;
|
|
73
|
+
const additions = fields.add_effects;
|
|
74
|
+
const item = additions.items;
|
|
75
|
+
const properties = item.properties;
|
|
76
|
+
properties.duration = { anyOf: [properties.duration, { const: 'infinite' }] };
|
|
77
|
+
}
|
|
78
|
+
if (['description.schema.json', 'description_2.schema.json'].some(name => file === path.join(root, 'schemas/rp/entity', name))) {
|
|
79
|
+
// Client entities can mix unconditional controllers and conditional entries.
|
|
80
|
+
const fields = document.properties;
|
|
81
|
+
const controllers = fields.render_controllers;
|
|
82
|
+
const alternatives = controllers.anyOf;
|
|
83
|
+
const items = alternatives.filter(entry => entry.type === 'array').map(entry => entry.items);
|
|
84
|
+
alternatives.push({ type: 'array', items: { anyOf: items } });
|
|
85
|
+
}
|
|
86
|
+
if (file.startsWith(path.join(root, 'schemas/rp/models') + path.sep)) {
|
|
87
|
+
// Geometry vectors accept numeric coordinates and Molang expressions.
|
|
88
|
+
const vectors = new Set(['visible_bounds_offset', 'pivot', 'rotation', 'origin', 'size', 'uv', 'uv_size', 'translation', 'scale']);
|
|
89
|
+
const visit = (value, vector = false) => {
|
|
90
|
+
if (Array.isArray(value)) {
|
|
91
|
+
value.forEach(entry => visit(entry, vector));
|
|
92
|
+
}
|
|
93
|
+
else if (value && typeof value === 'object') {
|
|
94
|
+
const node = value;
|
|
95
|
+
const items = node.items;
|
|
96
|
+
if (vector && node.type === 'array' && items?.type === 'string') {
|
|
97
|
+
items.type = ['string', 'number'];
|
|
98
|
+
}
|
|
99
|
+
for (const [key, entry] of Object.entries(node)) {
|
|
100
|
+
visit(entry, vector || vectors.has(key));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
visit(document);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
68
107
|
function normalize(value) {
|
|
69
108
|
if (Array.isArray(value)) {
|
|
70
109
|
value.forEach(normalize);
|