@sandstone-mc/mcdoc-ts-generator 0.1.6 → 0.1.8
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/dist/cli.js +16 -14
- package/dist/index.js +16 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1551,7 +1551,7 @@ var static_value3 = {
|
|
|
1551
1551
|
};
|
|
1552
1552
|
var ResourceClasses = {
|
|
1553
1553
|
"minecraft:advancement": "AdvancementClass",
|
|
1554
|
-
"minecraft:function": "
|
|
1554
|
+
"minecraft:function": "MCFunctionClass"
|
|
1555
1555
|
};
|
|
1556
1556
|
function mcdoc_string(type) {
|
|
1557
1557
|
const string = type;
|
|
@@ -1699,15 +1699,15 @@ function mcdoc_string(type) {
|
|
|
1699
1699
|
}).with({ name: "integer" }, () => {
|
|
1700
1700
|
return (args) => static_value3.number;
|
|
1701
1701
|
}).with({ name: "item_slots" }, () => {
|
|
1702
|
-
const
|
|
1702
|
+
const ENTITY_SLOTS = "ENTITY_SLOTS";
|
|
1703
1703
|
const LiteralUnion = "LiteralUnion";
|
|
1704
1704
|
return (args) => ({
|
|
1705
1705
|
type: factory17.createTypeReferenceNode(LiteralUnion, [
|
|
1706
|
-
factory17.createTypeReferenceNode(
|
|
1706
|
+
factory17.createTypeReferenceNode(ENTITY_SLOTS)
|
|
1707
1707
|
]),
|
|
1708
1708
|
imports: {
|
|
1709
|
-
ordered: [`sandstone::arguments::${
|
|
1710
|
-
check: new Map([[`sandstone::arguments::${
|
|
1709
|
+
ordered: [`sandstone::arguments::${ENTITY_SLOTS}`, `sandstone::${LiteralUnion}`],
|
|
1710
|
+
check: new Map([[`sandstone::arguments::${ENTITY_SLOTS}`, 0], [`sandstone::${LiteralUnion}`, 1]])
|
|
1711
1711
|
}
|
|
1712
1712
|
});
|
|
1713
1713
|
}).with({ name: "nbt" }, ({ value }) => {
|
|
@@ -1759,7 +1759,7 @@ function mcdoc_string(type) {
|
|
|
1759
1759
|
])
|
|
1760
1760
|
});
|
|
1761
1761
|
}).with({ name: "score_holder" }, () => {
|
|
1762
|
-
const Score = "
|
|
1762
|
+
const Score = "Score";
|
|
1763
1763
|
return (args) => ({
|
|
1764
1764
|
type: factory17.createUnionTypeNode([
|
|
1765
1765
|
static_value3.not_empty,
|
|
@@ -1957,12 +1957,12 @@ function mcdoc_struct(type) {
|
|
|
1957
1957
|
imports = add_import(imports, registry_import);
|
|
1958
1958
|
inherit.push(Bind.MappedType(factory18.createIndexedAccessTypeNode(factory18.createTypeReferenceNode("Registry"), Bind.StringLiteral(registry_id)), value.type));
|
|
1959
1959
|
}).with({ name: "item_slots" }, () => {
|
|
1960
|
-
const
|
|
1960
|
+
const ENTITY_SLOTS = "ENTITY_SLOTS";
|
|
1961
1961
|
const LiteralUnion = "LiteralUnion";
|
|
1962
|
-
imports = add_import(imports, `sandstone::arguments::${
|
|
1962
|
+
imports = add_import(imports, `sandstone::arguments::${ENTITY_SLOTS}`);
|
|
1963
1963
|
imports = add_import(imports, `sandstone::${LiteralUnion}`);
|
|
1964
1964
|
inherit.push(Bind.MappedType(factory18.createTypeReferenceNode(LiteralUnion, [
|
|
1965
|
-
factory18.createTypeReferenceNode(
|
|
1965
|
+
factory18.createTypeReferenceNode(ENTITY_SLOTS)
|
|
1966
1966
|
]), value.type));
|
|
1967
1967
|
}).with({ name: "objective" }, () => {
|
|
1968
1968
|
const Objective = "ObjectiveClass";
|
|
@@ -2691,11 +2691,13 @@ class TypesGenerator {
|
|
|
2691
2691
|
if (_path.endsWith(">")) {
|
|
2692
2692
|
continue;
|
|
2693
2693
|
}
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2694
|
+
if (!_path.endsWith("::StructureNBT")) {
|
|
2695
|
+
const matches = mcdoc_raw.matchAll(new RegExp(_path, "g"));
|
|
2696
|
+
const first_match = matches.next();
|
|
2697
|
+
const second_match = matches.next();
|
|
2698
|
+
if (!first_match.done && second_match.done) {
|
|
2699
|
+
continue;
|
|
2700
|
+
}
|
|
2699
2701
|
}
|
|
2700
2702
|
if (data !== null && typeof data === "object" && "typeDef" in data) {
|
|
2701
2703
|
const type = data.typeDef;
|
package/dist/index.js
CHANGED
|
@@ -1549,7 +1549,7 @@ var static_value3 = {
|
|
|
1549
1549
|
};
|
|
1550
1550
|
var ResourceClasses = {
|
|
1551
1551
|
"minecraft:advancement": "AdvancementClass",
|
|
1552
|
-
"minecraft:function": "
|
|
1552
|
+
"minecraft:function": "MCFunctionClass"
|
|
1553
1553
|
};
|
|
1554
1554
|
function mcdoc_string(type) {
|
|
1555
1555
|
const string = type;
|
|
@@ -1697,15 +1697,15 @@ function mcdoc_string(type) {
|
|
|
1697
1697
|
}).with({ name: "integer" }, () => {
|
|
1698
1698
|
return (args) => static_value3.number;
|
|
1699
1699
|
}).with({ name: "item_slots" }, () => {
|
|
1700
|
-
const
|
|
1700
|
+
const ENTITY_SLOTS = "ENTITY_SLOTS";
|
|
1701
1701
|
const LiteralUnion = "LiteralUnion";
|
|
1702
1702
|
return (args) => ({
|
|
1703
1703
|
type: factory17.createTypeReferenceNode(LiteralUnion, [
|
|
1704
|
-
factory17.createTypeReferenceNode(
|
|
1704
|
+
factory17.createTypeReferenceNode(ENTITY_SLOTS)
|
|
1705
1705
|
]),
|
|
1706
1706
|
imports: {
|
|
1707
|
-
ordered: [`sandstone::arguments::${
|
|
1708
|
-
check: new Map([[`sandstone::arguments::${
|
|
1707
|
+
ordered: [`sandstone::arguments::${ENTITY_SLOTS}`, `sandstone::${LiteralUnion}`],
|
|
1708
|
+
check: new Map([[`sandstone::arguments::${ENTITY_SLOTS}`, 0], [`sandstone::${LiteralUnion}`, 1]])
|
|
1709
1709
|
}
|
|
1710
1710
|
});
|
|
1711
1711
|
}).with({ name: "nbt" }, ({ value }) => {
|
|
@@ -1757,7 +1757,7 @@ function mcdoc_string(type) {
|
|
|
1757
1757
|
])
|
|
1758
1758
|
});
|
|
1759
1759
|
}).with({ name: "score_holder" }, () => {
|
|
1760
|
-
const Score = "
|
|
1760
|
+
const Score = "Score";
|
|
1761
1761
|
return (args) => ({
|
|
1762
1762
|
type: factory17.createUnionTypeNode([
|
|
1763
1763
|
static_value3.not_empty,
|
|
@@ -1955,12 +1955,12 @@ function mcdoc_struct(type) {
|
|
|
1955
1955
|
imports = add_import(imports, registry_import);
|
|
1956
1956
|
inherit.push(Bind.MappedType(factory18.createIndexedAccessTypeNode(factory18.createTypeReferenceNode("Registry"), Bind.StringLiteral(registry_id)), value.type));
|
|
1957
1957
|
}).with({ name: "item_slots" }, () => {
|
|
1958
|
-
const
|
|
1958
|
+
const ENTITY_SLOTS = "ENTITY_SLOTS";
|
|
1959
1959
|
const LiteralUnion = "LiteralUnion";
|
|
1960
|
-
imports = add_import(imports, `sandstone::arguments::${
|
|
1960
|
+
imports = add_import(imports, `sandstone::arguments::${ENTITY_SLOTS}`);
|
|
1961
1961
|
imports = add_import(imports, `sandstone::${LiteralUnion}`);
|
|
1962
1962
|
inherit.push(Bind.MappedType(factory18.createTypeReferenceNode(LiteralUnion, [
|
|
1963
|
-
factory18.createTypeReferenceNode(
|
|
1963
|
+
factory18.createTypeReferenceNode(ENTITY_SLOTS)
|
|
1964
1964
|
]), value.type));
|
|
1965
1965
|
}).with({ name: "objective" }, () => {
|
|
1966
1966
|
const Objective = "ObjectiveClass";
|
|
@@ -2689,11 +2689,13 @@ class TypesGenerator {
|
|
|
2689
2689
|
if (_path.endsWith(">")) {
|
|
2690
2690
|
continue;
|
|
2691
2691
|
}
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2692
|
+
if (!_path.endsWith("::StructureNBT")) {
|
|
2693
|
+
const matches = mcdoc_raw.matchAll(new RegExp(_path, "g"));
|
|
2694
|
+
const first_match = matches.next();
|
|
2695
|
+
const second_match = matches.next();
|
|
2696
|
+
if (!first_match.done && second_match.done) {
|
|
2697
|
+
continue;
|
|
2698
|
+
}
|
|
2697
2699
|
}
|
|
2698
2700
|
if (data !== null && typeof data === "object" && "typeDef" in data) {
|
|
2699
2701
|
const type = data.typeDef;
|