@sandstone-mc/mcdoc-ts-generator 0.1.4 → 0.1.5

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
@@ -2543,10 +2543,13 @@ function dispatcher_symbol(id, name, members, dispatcher_properties, module_map,
2543
2543
  var DispatcherSymbol = dispatcher_symbol;
2544
2544
 
2545
2545
  // src/typegen/export.ts
2546
+ import { TaggableResourceLocationCategories } from "@spyglassmc/core";
2546
2547
  import ts25 from "typescript";
2547
2548
  var { factory: factory24 } = ts25;
2548
2549
  function export_registry(resolved_registries) {
2549
2550
  let imports;
2551
+ imports = add_import(imports, "sandstone::Set");
2552
+ imports = add_import(imports, "sandstone::SetType");
2550
2553
  const properties = [];
2551
2554
  for (const [registry_name, { import_path, registry }] of resolved_registries) {
2552
2555
  imports = add_import(imports, import_path);
@@ -2554,8 +2557,10 @@ function export_registry(resolved_registries) {
2554
2557
  properties.push(factory24.createPropertySignature(undefined, factory24.createStringLiteral(registry_id), undefined, factory24.createTypeReferenceNode(registry)));
2555
2558
  }
2556
2559
  const registry_type = factory24.createTypeAliasDeclaration([factory24.createToken(ts25.SyntaxKind.ExportKeyword)], "Registry", undefined, factory24.createTypeLiteralNode(properties));
2560
+ const registries_set = factory24.createVariableStatement([factory24.createToken(ts25.SyntaxKind.ExportKeyword)], factory24.createVariableDeclarationList([factory24.createVariableDeclaration("REGISTRIES_SET", undefined, undefined, factory24.createNewExpression(factory24.createIdentifier("Set"), undefined, [factory24.createAsExpression(factory24.createArrayLiteralExpression(TaggableResourceLocationCategories.map((category) => factory24.createStringLiteral(category, true)), true), factory24.createTypeReferenceNode("const"))]))], ts25.NodeFlags.Const));
2561
+ const registries_type = factory24.createTypeAliasDeclaration([factory24.createToken(ts25.SyntaxKind.ExportKeyword)], "REGISTRIES", undefined, factory24.createTypeReferenceNode("SetType", [factory24.createTypeQueryNode(factory24.createIdentifier("REGISTRIES_SET"))]));
2557
2562
  return {
2558
- exports: [registry_type],
2563
+ exports: [registry_type, registries_set, registries_type],
2559
2564
  paths: new Set,
2560
2565
  ...add({ imports })
2561
2566
  };
package/dist/index.js CHANGED
@@ -2541,10 +2541,13 @@ function dispatcher_symbol(id, name, members, dispatcher_properties, module_map,
2541
2541
  var DispatcherSymbol = dispatcher_symbol;
2542
2542
 
2543
2543
  // src/typegen/export.ts
2544
+ import { TaggableResourceLocationCategories } from "@spyglassmc/core";
2544
2545
  import ts25 from "typescript";
2545
2546
  var { factory: factory24 } = ts25;
2546
2547
  function export_registry(resolved_registries) {
2547
2548
  let imports;
2549
+ imports = add_import(imports, "sandstone::Set");
2550
+ imports = add_import(imports, "sandstone::SetType");
2548
2551
  const properties = [];
2549
2552
  for (const [registry_name, { import_path, registry }] of resolved_registries) {
2550
2553
  imports = add_import(imports, import_path);
@@ -2552,8 +2555,10 @@ function export_registry(resolved_registries) {
2552
2555
  properties.push(factory24.createPropertySignature(undefined, factory24.createStringLiteral(registry_id), undefined, factory24.createTypeReferenceNode(registry)));
2553
2556
  }
2554
2557
  const registry_type = factory24.createTypeAliasDeclaration([factory24.createToken(ts25.SyntaxKind.ExportKeyword)], "Registry", undefined, factory24.createTypeLiteralNode(properties));
2558
+ const registries_set = factory24.createVariableStatement([factory24.createToken(ts25.SyntaxKind.ExportKeyword)], factory24.createVariableDeclarationList([factory24.createVariableDeclaration("REGISTRIES_SET", undefined, undefined, factory24.createNewExpression(factory24.createIdentifier("Set"), undefined, [factory24.createAsExpression(factory24.createArrayLiteralExpression(TaggableResourceLocationCategories.map((category) => factory24.createStringLiteral(category, true)), true), factory24.createTypeReferenceNode("const"))]))], ts25.NodeFlags.Const));
2559
+ const registries_type = factory24.createTypeAliasDeclaration([factory24.createToken(ts25.SyntaxKind.ExportKeyword)], "REGISTRIES", undefined, factory24.createTypeReferenceNode("SetType", [factory24.createTypeQueryNode(factory24.createIdentifier("REGISTRIES_SET"))]));
2555
2560
  return {
2556
- exports: [registry_type],
2561
+ exports: [registry_type, registries_set, registries_type],
2557
2562
  paths: new Set,
2558
2563
  ...add({ imports })
2559
2564
  };
@@ -2,14 +2,14 @@ import ts from 'typescript';
2
2
  import { type NonEmptyList } from './mcdoc/utils';
3
3
  import type { ResolvedDispatcher, ResolvedRegistry } from '.';
4
4
  export declare function export_registry(resolved_registries: Map<string, ResolvedRegistry>): {
5
- readonly exports: ts.TypeAliasDeclaration[];
5
+ readonly exports: (ts.TypeAliasDeclaration | ts.VariableStatement)[];
6
6
  readonly paths: Set<string>;
7
7
  } | {
8
8
  readonly imports: {
9
9
  readonly ordered: NonEmptyList<string>;
10
10
  readonly check: Map<string, number>;
11
11
  };
12
- readonly exports: ts.TypeAliasDeclaration[];
12
+ readonly exports: (ts.TypeAliasDeclaration | ts.VariableStatement)[];
13
13
  readonly paths: Set<string>;
14
14
  };
15
15
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandstone-mc/mcdoc-ts-generator",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Generate TypeScript types from Minecraft mcdoc definitions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",