@spyglassmc/mcdoc 0.3.11 → 0.3.12

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.
@@ -536,7 +536,7 @@ function simplifyReference(typeDef, context) {
536
536
  }
537
537
  const mapped = context.typeMapping?.[typeDef.path];
538
538
  if (mapped) {
539
- return { typeDef: mapped };
539
+ return { typeDef: mapped, dynamicData: true };
540
540
  }
541
541
  // TODO Probably need to keep original symbol around in some way to support "go to definition"
542
542
  const symbol = context.ctx.symbols.query(context.ctx.doc, 'mcdoc', typeDef.path);
@@ -776,8 +776,8 @@ function simplifyUnion(typeDef, context) {
776
776
  }
777
777
  const members = [];
778
778
  for (const member of validMembers) {
779
- const { typeDef: simplified, dynamicData: memberDynamid } = simplify(member, context);
780
- if (memberDynamid) {
779
+ const { typeDef: simplified, dynamicData: memberDynamic } = simplify(member, context);
780
+ if (memberDynamic) {
781
781
  dynamicData = true;
782
782
  }
783
783
  if (simplified.kind === 'union') {
@@ -843,16 +843,23 @@ function simplifyStruct(typeDef, context) {
843
843
  }
844
844
  structKey = simplifiedKeyResult.typeDef;
845
845
  }
846
- const mappedField = context.typeMapping
847
- ? {
846
+ let mappedField;
847
+ if (context.typeMapping) {
848
+ mappedField = {
848
849
  ...field,
849
850
  type: {
850
851
  kind: 'mapped',
851
852
  child: field.type,
852
853
  mapping: context.typeMapping,
853
854
  },
854
- }
855
- : field;
855
+ };
856
+ // Don't cache mapped field data
857
+ // TODO find a better way to handle mapped types with caching
858
+ dynamicData = true;
859
+ }
860
+ else {
861
+ mappedField = field;
862
+ }
856
863
  addField(structKey, mappedField);
857
864
  }
858
865
  else {
@@ -886,6 +893,9 @@ function simplifyList(typeDef, context) {
886
893
  ...typeDef,
887
894
  item: { kind: 'mapped', child: typeDef.item, mapping: context.typeMapping },
888
895
  },
896
+ // Don't cache mapped field data
897
+ // TODO find a better way to handle mapped types with caching
898
+ dynamicData: true,
889
899
  };
890
900
  }
891
901
  function simplifyTuple(typeDef, context) {
@@ -901,6 +911,9 @@ function simplifyTuple(typeDef, context) {
901
911
  mapping: context.typeMapping,
902
912
  })),
903
913
  },
914
+ // Don't cache mapped field data
915
+ // TODO find a better way to handle mapped types with caching
916
+ dynamicData: true,
904
917
  };
905
918
  }
906
919
  function simplifyEnum(typeDef, context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spyglassmc/mcdoc",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/SpyglassMC/Spyglass/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@spyglassmc/core": "0.4.8",
28
+ "@spyglassmc/core": "0.4.9",
29
29
  "@spyglassmc/locales": "0.3.8"
30
30
  }
31
31
  }