@sandstone-mc/mcdoc-ts-generator 0.1.18 → 0.1.19

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 CHANGED
@@ -290,11 +290,13 @@ class Assert {
290
290
  }
291
291
  const attribute_type = attribute.name;
292
292
  match(attribute_type).with("since", "until", "deprecated", () => {
293
- if (attribute.value === undefined) {
293
+ if (attribute.value === undefined && attribute_type !== "deprecated") {
294
294
  throw new Error(`[mcdoc_assert] Versioned attribute '${attribute_type}' must have a value`);
295
295
  }
296
- if (attribute.value.kind !== "literal" || attribute.value.value.kind !== "string" || !/^\d+\.\d+(?:\.\d+)?$/.test(attribute.value.value.value)) {
297
- throw new Error(`[mcdoc_assert] Versioned Attribute Type value is invalid ${attribute.value}`);
296
+ if (attribute.value !== undefined) {
297
+ if (attribute.value.kind !== "literal" || attribute.value.value.kind !== "string" || !/^\d+\.\d+(?:\.\d+)?$/.test(attribute.value.value.value)) {
298
+ throw new Error(`[mcdoc_assert] Versioned Attribute Type value is invalid ${attribute.value}`);
299
+ }
298
300
  }
299
301
  }).with("id", () => {
300
302
  if (attribute.value !== undefined) {
package/dist/index.js CHANGED
@@ -288,11 +288,13 @@ class Assert {
288
288
  }
289
289
  const attribute_type = attribute.name;
290
290
  match(attribute_type).with("since", "until", "deprecated", () => {
291
- if (attribute.value === undefined) {
291
+ if (attribute.value === undefined && attribute_type !== "deprecated") {
292
292
  throw new Error(`[mcdoc_assert] Versioned attribute '${attribute_type}' must have a value`);
293
293
  }
294
- if (attribute.value.kind !== "literal" || attribute.value.value.kind !== "string" || !/^\d+\.\d+(?:\.\d+)?$/.test(attribute.value.value.value)) {
295
- throw new Error(`[mcdoc_assert] Versioned Attribute Type value is invalid ${attribute.value}`);
294
+ if (attribute.value !== undefined) {
295
+ if (attribute.value.kind !== "literal" || attribute.value.value.kind !== "string" || !/^\d+\.\d+(?:\.\d+)?$/.test(attribute.value.value.value)) {
296
+ throw new Error(`[mcdoc_assert] Versioned Attribute Type value is invalid ${attribute.value}`);
297
+ }
296
298
  }
297
299
  }).with("id", () => {
298
300
  if (attribute.value !== undefined) {
@@ -254,7 +254,15 @@ type ImplementedAttributes = {
254
254
  value: string;
255
255
  };
256
256
  };
257
- deprecated: undefined;
257
+ deprecated: (undefined | {
258
+ attributes: never;
259
+ kind: 'literal';
260
+ value: {
261
+ attributes: never;
262
+ kind: 'string';
263
+ value: `${number}.${number}.${number}`;
264
+ };
265
+ });
258
266
  command: {
259
267
  attributes: never;
260
268
  kind: 'tree';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandstone-mc/mcdoc-ts-generator",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Generate TypeScript types from Minecraft mcdoc definitions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",