@satisfactory-dev/docs.json.ts 0.11.0 → 0.11.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.
@@ -21,11 +21,13 @@ export declare class DocsTsGeneratorVersion {
21
21
  docs: DocsData | undefined;
22
22
  readonly cache_path: string | undefined;
23
23
  readonly docs_path: string | DocsData;
24
+ readonly types_from_module: string | undefined;
24
25
  readonly UnrealEngineString_quote_mode: typeof UnrealEngineString['quote_mode'];
25
- constructor({ docs_path, cache_path, UnrealEngineString_quote_mode, }: {
26
+ constructor({ docs_path, cache_path, UnrealEngineString_quote_mode, types_from_module, }: {
26
27
  cache_path: string | undefined;
27
28
  docs_path: string | DocsData;
28
29
  UnrealEngineString_quote_mode: typeof UnrealEngineString['quote_mode'];
30
+ types_from_module?: string;
29
31
  });
30
32
  }
31
33
  export type docs_versions = {
@@ -36,7 +38,6 @@ export declare class DocsTsGenerator {
36
38
  private readonly schema_data;
37
39
  readonly ajv: Ajv;
38
40
  readonly docs_versions: docs_versions;
39
- readonly types_from_module: string | undefined;
40
41
  static readonly PERF_EARLY_RETURN = "Early Return of Docs.json";
41
42
  static readonly PERF_FAILURE = "Failure to load Docs.json";
42
43
  static readonly PERF_FILE_PARSED = "Docs.json contents parsed";
@@ -46,10 +47,9 @@ export declare class DocsTsGenerator {
46
47
  static readonly PERF_VALIDATION_FINISHED = "Docs.json validation finished";
47
48
  static readonly PERF_VALIDATION_PRECOMPILE = "Docs.json validation pre-compilation started";
48
49
  static readonly PERF_VALIDATION_STARTED = "Docs.json validation started";
49
- constructor({ ajv, docs_versions, types_from_module, }: {
50
+ constructor({ ajv, docs_versions, }: {
50
51
  ajv: Ajv;
51
52
  docs_versions: docs_versions;
52
- types_from_module?: string;
53
53
  });
54
54
  definition(version: keyof docs_versions, $ref: string): Promise<SchemaObject>;
55
55
  get(version: keyof docs_versions): Promise<DocsData>;
@@ -26,16 +26,18 @@ export class DocsTsGeneratorVersion {
26
26
  docs;
27
27
  cache_path;
28
28
  docs_path;
29
+ types_from_module;
29
30
  // eslint-disable-next-line max-len
30
31
  UnrealEngineString_quote_mode;
31
32
  constructor({
32
33
  // raw JSON or path to UTF-16LE encoded Docs.json
33
34
  docs_path,
34
35
  // optional cache folder path for cacheable resources
35
- cache_path = undefined, UnrealEngineString_quote_mode, }) {
36
+ cache_path = undefined, UnrealEngineString_quote_mode, types_from_module = undefined, }) {
36
37
  this.cache_path = cache_path;
37
38
  this.docs_path = docs_path;
38
39
  this.UnrealEngineString_quote_mode = UnrealEngineString_quote_mode;
40
+ this.types_from_module = types_from_module;
39
41
  }
40
42
  }
41
43
  export class DocsTsGenerator {
@@ -43,7 +45,6 @@ export class DocsTsGenerator {
43
45
  schema_data = new DocsSchemaByVersion();
44
46
  ajv;
45
47
  docs_versions;
46
- types_from_module;
47
48
  static PERF_EARLY_RETURN = 'Early Return of Docs.json';
48
49
  static PERF_FAILURE = 'Failure to load Docs.json';
49
50
  static PERF_FILE_PARSED = 'Docs.json contents parsed';
@@ -57,13 +58,12 @@ export class DocsTsGenerator {
57
58
  // Ajv instance
58
59
  ajv,
59
60
  // Docs object
60
- docs_versions, types_from_module = undefined, }) {
61
+ docs_versions, }) {
61
62
  if (Object.keys(docs_versions).length < 1) {
62
63
  throw new Error('No versions specified!');
63
64
  }
64
65
  this.ajv = ajv;
65
66
  this.docs_versions = docs_versions;
66
- this.types_from_module = types_from_module;
67
67
  }
68
68
  async definition(version, $ref) {
69
69
  const schema = await this.schema(version);
@@ -206,8 +206,9 @@ export class TypeDefinitionWriter {
206
206
  }
207
207
  let code = await format_code(node_strings
208
208
  .join('\n\n'));
209
- if (this.docs.types_from_module) {
210
- code = code.replace(/} from '(?:\.\.\/)+(classes|common|utils)\//g, `} from '${this.docs.types_from_module}/$1/`);
209
+ const types_from_module = this.docs.docs_versions[this.version]?.types_from_module;
210
+ if (types_from_module) {
211
+ code = code.replace(/} from '(?:\.\.\/)+(classes|common|utils)\//g, `} from '${types_from_module}/$1/`);
211
212
  }
212
213
  await writeFile(file_name, code);
213
214
  }
package/package.json CHANGED
@@ -38,5 +38,5 @@
38
38
  "typescript": "~5.5.2",
39
39
  "typescript-eslint": "^8.2.0"
40
40
  },
41
- "version": "0.11.0"
41
+ "version": "0.11.1"
42
42
  }