s2cfgtojson 2.3.0 → 3.0.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/Struct.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./types.mts";
2
2
  export * from "./enums.mts";
3
- import { DefaultEntries, Struct as IStruct, Value } from "./types.mts";
3
+ import { DefaultEntries, IStruct, Value } from "./types.mts";
4
4
 
5
5
  const TAB = " ";
6
6
  const WILDCARD = "_wildcard";
package/Struct.test.mts CHANGED
@@ -1,5 +1,11 @@
1
1
  import { describe, test, expect } from "vitest";
2
- import { createDynamicClassInstance, ERank, pad, Struct } from "./Struct.mjs";
2
+ import {
3
+ createDynamicClassInstance,
4
+ ERank,
5
+ pad,
6
+ IStruct,
7
+ Struct,
8
+ } from "./Struct.mjs";
3
9
  import fs from "node:fs";
4
10
 
5
11
  class ChimeraHPFix extends Struct {
@@ -196,7 +202,7 @@ struct.end`;
196
202
  N5 = .1f
197
203
  N6 = -2.22f
198
204
  struct.end`;
199
- const str = Struct.fromString<Struct & { [key: `N${number}`]: number }>(
205
+ const str = Struct.fromString<IStruct & { [key: `N${number}`]: number }>(
200
206
  dynamicItemGeneratorText,
201
207
  );
202
208
  expect(str[0].N1).toBe(0.1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s2cfgtojson",
3
- "version": "2.3.0",
3
+ "version": "3.0.1",
4
4
  "description": "Converts Stalker 2 Cfg file into POJOs",
5
5
  "keywords": [
6
6
  "stalker",
package/types.mts CHANGED
@@ -66,9 +66,10 @@ import {
66
66
  ERequiredSquadMembers,
67
67
  EMeshSubType,
68
68
  } from "./enums.mjs";
69
+ import { Struct } from "./Struct.mjs";
69
70
 
70
71
  export type Internal = "__internal__";
71
- export type Struct = {
72
+ export type IStruct = {
72
73
  [k in Internal]: DefaultEntries;
73
74
  };
74
75
 
@@ -84,28 +85,8 @@ export interface DefaultEntries {
84
85
  }
85
86
 
86
87
  export type Value = string | boolean | number;
87
-
88
88
  export type Entries = Record<string | number, Value>;
89
-
90
- export type GetTsType<E extends Struct> = {
91
- [key in Exclude<keyof E, Internal>]: E[key] extends Struct
92
- ? GetTsType<E[key]>
93
- : E[key];
94
- };
95
- type RKey<In> = Exclude<keyof In, keyof DefaultEntries>;
96
-
97
- export type GetStructType<In> =
98
- In extends Array<any>
99
- ? Struct & { [key in number]: GetStructType<In[key]> }
100
- : In extends Record<any, any>
101
- ? Struct & { [key in RKey<In>]: GetStructType<In[key]> }
102
- : In extends string
103
- ? In
104
- : In extends number
105
- ? number
106
- : In extends boolean
107
- ? boolean
108
- : never;
89
+ export type GetStructType<In> = Struct & In;
109
90
 
110
91
  export type ArmorPrototype = GetStructType<{
111
92
  SID: string;