expo-type-information 0.0.2 → 0.0.4

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.
Files changed (51) hide show
  1. package/build/cli.js +3 -1
  2. package/build/cli.js.map +1 -1
  3. package/build/commands/commandUtils.js +2 -2
  4. package/build/commands/commandUtils.js.map +1 -1
  5. package/build/commands/generateJSXIntrinsicsCommand.js +3 -1
  6. package/build/commands/generateJSXIntrinsicsCommand.js.map +1 -1
  7. package/build/commands/generateMocksForFileCommand.js +3 -1
  8. package/build/commands/generateMocksForFileCommand.js.map +1 -1
  9. package/build/commands/generateModuleTypesCommand.js +3 -1
  10. package/build/commands/generateModuleTypesCommand.js.map +1 -1
  11. package/build/commands/generateViewTypesCommand.js +3 -1
  12. package/build/commands/generateViewTypesCommand.js.map +1 -1
  13. package/build/commands/inlineModulesInterfaceCommand.js +5 -2
  14. package/build/commands/inlineModulesInterfaceCommand.js.map +1 -1
  15. package/build/commands/moduleInterfaceCommand.js +7 -1
  16. package/build/commands/moduleInterfaceCommand.js.map +1 -1
  17. package/build/commands/preprocessFileCommand.d.ts +2 -0
  18. package/build/commands/preprocessFileCommand.js +31 -0
  19. package/build/commands/preprocessFileCommand.js.map +1 -0
  20. package/build/commands/shortModuleInterfaceCommand.js +1 -1
  21. package/build/commands/shortModuleInterfaceCommand.js.map +1 -1
  22. package/build/commands/typeInformationCommand.js +3 -1
  23. package/build/commands/typeInformationCommand.js.map +1 -1
  24. package/build/index.d.ts +1 -1
  25. package/build/index.js.map +1 -1
  26. package/build/mockgen.d.ts +21 -0
  27. package/build/mockgen.js +21 -0
  28. package/build/mockgen.js.map +1 -1
  29. package/build/typeInformation.d.ts +114 -11
  30. package/build/typeInformation.js +37 -16
  31. package/build/typeInformation.js.map +1 -1
  32. package/build/typescriptGeneration.d.ts +50 -0
  33. package/build/typescriptGeneration.js +42 -1
  34. package/build/typescriptGeneration.js.map +1 -1
  35. package/package.json +2 -2
  36. package/src/cli.ts +3 -1
  37. package/src/commands/commandUtils.ts +2 -2
  38. package/src/commands/generateJSXIntrinsicsCommand.ts +6 -4
  39. package/src/commands/generateMocksForFileCommand.ts +4 -4
  40. package/src/commands/generateModuleTypesCommand.ts +4 -4
  41. package/src/commands/generateViewTypesCommand.ts +4 -4
  42. package/src/commands/inlineModulesInterfaceCommand.ts +10 -3
  43. package/src/commands/moduleInterfaceCommand.ts +7 -1
  44. package/src/commands/preprocessFileCommand.ts +41 -0
  45. package/src/commands/shortModuleInterfaceCommand.ts +1 -1
  46. package/src/commands/typeInformationCommand.ts +4 -4
  47. package/src/index.ts +1 -0
  48. package/src/mockgen.ts +21 -0
  49. package/src/typeInformation.ts +141 -22
  50. package/src/typescriptGeneration.ts +53 -1
  51. package/tests/__snapshots__/typeInformation.test.ts.snap +25 -25
@@ -1,38 +1,82 @@
1
+ /**
2
+ * Represents the kind of a parsed identifier from a native file.
3
+ */
1
4
  export declare enum IdentifierKind {
2
5
  BASIC = 0,
3
6
  ENUM = 1,
4
7
  RECORD = 2,
5
8
  CLASS = 3
6
9
  }
10
+ /**
11
+ * Represents a parametrized type, that is a generic type with specified parameters e.g. Map<string, number>.
12
+ */
7
13
  export type ParametrizedType = {
8
14
  name: TypeIdentifier;
9
15
  types: Type[];
10
16
  };
17
+ /**
18
+ * Represents an argument passed to a function or constructor.
19
+ */
11
20
  export type Argument = {
12
21
  name: string | undefined;
13
22
  type: Type;
14
23
  };
24
+ /**
25
+ * Represents a single field within a record or a struct.
26
+ */
15
27
  export type Field = Argument;
28
+ /**
29
+ * Represents a struct or dictionary-like record consisting of named fields.
30
+ */
16
31
  export type RecordType = {
17
32
  name: string;
18
33
  fields: Field[];
19
34
  };
35
+ /**
36
+ * Represents a single case inside an enum declaration.
37
+ */
20
38
  export type EnumCase = string;
39
+ /**
40
+ * Represents an enum type, containing its name and all associated cases.
41
+ */
21
42
  export type EnumType = {
22
43
  name: string;
23
44
  cases: EnumCase[];
24
45
  };
46
+ /**
47
+ * Represents a union or a sum type where a value can be one of several different types.
48
+ */
25
49
  export type SumType = {
26
50
  types: Type[];
27
51
  };
52
+ /**
53
+ * Represents a dictionary type, defining the explicit types for its keys and values.
54
+ */
28
55
  export type DictionaryType = {
29
56
  key: Type;
30
57
  value: Type;
31
58
  };
59
+ /**
60
+ * Represents an optional type that can also resolve to null or undefined.
61
+ * > **Note:** The information that this type is optional is implicit and exists only in the type system and on the parent type. There is no field on the `OptionalType` object that explicitly indicates that.
62
+ */
32
63
  export type OptionalType = Type;
64
+ /**
65
+ * Represents a list or array of a specific type.
66
+ * > **Note:** The information that this type is array is implicit and exists only in the type system and on the parent type. There is no field on the `ArrayType` object that explicitly indicates that.
67
+ */
33
68
  export type ArrayType = Type;
69
+ /**
70
+ * Represents a type identifier as a string reference.
71
+ */
34
72
  export type TypeIdentifier = string;
73
+ /**
74
+ * Represents an anonymous type, a one that is not named instead written directly in the code, such as inline generics, arrays, or optionals.
75
+ */
35
76
  export type AnonymousType = ParametrizedType | SumType | OptionalType | DictionaryType | ArrayType;
77
+ /**
78
+ * Categorizes the type node within the abstract syntax tree.
79
+ */
36
80
  export declare enum TypeKind {
37
81
  BASIC = 0,
38
82
  IDENTIFIER = 1,
@@ -42,6 +86,9 @@ export declare enum TypeKind {
42
86
  ARRAY = 5,
43
87
  DICTIONARY = 6
44
88
  }
89
+ /**
90
+ * Represents a basic type that is not user defined.
91
+ */
45
92
  export declare enum BasicType {
46
93
  ANY = 0,
47
94
  STRING = 1,
@@ -49,40 +96,70 @@ export declare enum BasicType {
49
96
  BOOLEAN = 3,
50
97
  VOID = 4,
51
98
  UNDEFINED = 5,
99
+ /** Represents a type that couldn't be resolved */
52
100
  UNRESOLVED = 6
53
101
  }
102
+ /**
103
+ * Represents an abstract type node.
104
+ */
54
105
  export type Type = {
55
106
  kind: TypeKind;
56
107
  type: BasicType | TypeIdentifier | AnonymousType;
57
108
  };
109
+ /**
110
+ * Represents a DSL property declaration.
111
+ */
58
112
  export type PropertyDeclaration = ConstantDeclaration;
113
+ /**
114
+ * Represents a DSL view declaration.
115
+ */
59
116
  export type ViewDeclaration = ModuleClassDeclaration;
117
+ /**
118
+ * Represents a DSL event declaration.
119
+ */
60
120
  export type EventDeclaration = string;
61
121
  /**
62
- * Retain information of where the thing was defined in the file.
122
+ * Retains information of where the thing was defined in the file.
63
123
  * As collecting type information is written in asynchronous way it is non-deterministic.
64
- * To make it deterministic we just sort the declaration by the definitionOffset, maintianing the same ordering as in original file.
124
+ * To make it deterministic we just sort the declaration by the definitionOffset, maintaining the same ordering as in original file.
125
+ * @header TypeInfoTypes
65
126
  */
66
127
  export type DefinitionOffset = {
67
128
  definitionOffset: number;
68
129
  };
130
+ /**
131
+ * Represents a DSL constant declaration.
132
+ */
69
133
  export type ConstantDeclaration = {
70
134
  name: string;
71
135
  type: Type;
72
136
  } & DefinitionOffset;
137
+ /**
138
+ * Represents a DSL function declaration.
139
+ * @hideType
140
+ */
73
141
  export type FunctionDeclaration = {
74
142
  name: string;
75
143
  returnType: Type;
76
144
  arguments: Argument[];
77
145
  parameters: Type[];
78
146
  } & DefinitionOffset;
147
+ /**
148
+ * Represents a DSL prop declaration.
149
+ */
79
150
  export type PropDeclaration = {
80
151
  name: string;
81
152
  arguments: Argument[];
82
153
  } & DefinitionOffset;
154
+ /**
155
+ * Represents a DSL class constructor declaration.
156
+ */
83
157
  export type ConstructorDeclaration = {
84
158
  arguments: Argument[];
85
159
  } & DefinitionOffset;
160
+ /**
161
+ * Represents a DSL native class declaration.
162
+ */
86
163
  export type ClassDeclaration = {
87
164
  name: string;
88
165
  constructor: ConstructorDeclaration | null;
@@ -90,6 +167,9 @@ export type ClassDeclaration = {
90
167
  asyncMethods: FunctionDeclaration[];
91
168
  properties: PropertyDeclaration[];
92
169
  } & DefinitionOffset;
170
+ /**
171
+ * Represents a DSL module declaration.
172
+ */
93
173
  export type ModuleClassDeclaration = {
94
174
  name: string;
95
175
  constructor: ConstructorDeclaration | null;
@@ -102,12 +182,24 @@ export type ModuleClassDeclaration = {
102
182
  views: ViewDeclaration[];
103
183
  events: EventDeclaration[];
104
184
  } & DefinitionOffset;
185
+ /**
186
+ * Represents a definition of an identifier.
187
+ */
105
188
  export type IdentifierDefinition = {
106
189
  kind: IdentifierKind;
107
190
  definition: string | RecordType | EnumType | ClassDeclaration;
108
191
  };
192
+ /**
193
+ * Maps type identifier strings to their definition objects.
194
+ */
109
195
  export type TypeIdentifierDefinitionMap = Map<string, IdentifierDefinition>;
196
+ /**
197
+ * Serialized version of the `TypeIdentifierDefinitionMap`.
198
+ */
110
199
  export type TypeIdentifierDefinitionList = [string, IdentifierDefinition][];
200
+ /**
201
+ * Serialized version of the `FileTypeInformation`, suitable for JSON storage or testing environments.
202
+ */
111
203
  export type FileTypeInformationSerialized = {
112
204
  usedTypeIdentifiersList: string[];
113
205
  declaredTypeIdentifiersList: string[];
@@ -118,9 +210,10 @@ export type FileTypeInformationSerialized = {
118
210
  enums: EnumType[];
119
211
  };
120
212
  /**
121
- * FileTypeInformation object abstracts over type related information in a file.
213
+ * `FileTypeInformation` object abstracts over type related information in a file.
122
214
  * The abstraction is closely related to Typescript and expo NativeModules (both to be independent of the actual native side
123
215
  * and to give accurate information about what and how we can use the given module).
216
+ * @header TypeInfoTypes
124
217
  */
125
218
  export type FileTypeInformation = {
126
219
  /**
@@ -158,20 +251,22 @@ export type FileTypeInformation = {
158
251
  enums: EnumType[];
159
252
  };
160
253
  /**
161
- * Used for testing purposes, maps Sets and Maps to Arrays and returns FileTypeInformationSerialized object which can be written to a JSON.
162
- * @param param0 FileTypeInformation object to serialize.
163
- * @returns FileTypeInformationSerialized object.
254
+ * Used for testing purposes, maps Sets and Maps to Arrays and returns `FileTypeInformationSerialized` object which can be written to a JSON.
255
+ * @param fileTypeinformation `FileTypeInformation` object to serialize.
256
+ * @returns a `FileTypeInformationSerialized` object.
257
+ * @header TypeInformationAbstraction
164
258
  */
165
259
  export declare function serializeTypeInformation({ usedTypeIdentifiers, declaredTypeIdentifiers, inferredTypeParametersCount, typeIdentifierDefinitionMap, moduleClasses, records, enums, }: FileTypeInformation): FileTypeInformationSerialized;
166
260
  /**
167
- * Used for testing purposes, maps Arrays to Sets and Maps depending on the field and returns FileTypeInformation object.
168
- * @param param0 FileTypeInformationSerialized object to deserialize.
169
- * @returns FileTypeInformation object.
261
+ * Used for testing purposes, maps Arrays to Sets and Maps depending on the field and returns `FileTypeInformation` object.
262
+ * @param fileTypeinformationSerialized `FileTypeInformationSerialized` object to deserialize.
263
+ * @returns `FileTypeInformation` object.
264
+ * @header TypeInformationAbstraction
170
265
  */
171
266
  export declare function deserializeTypeInformation({ usedTypeIdentifiersList, declaredTypeIdentifiersList, inferredTypeParametersCountList, typeIdentifierDefinitionList, moduleClasses, records, enums, }: FileTypeInformationSerialized): FileTypeInformation;
172
267
  /**
173
268
  * Defines the level of type inference to apply when extracting type information.
174
- * Note: In case where type inference is on, it may take more then twice the time to compute the type information.
269
+ * > **Note:** In case where type inference is on, it may take more then twice the time to compute the type information.
175
270
  */
176
271
  export declare enum TypeInferenceOption {
177
272
  /** No type inference will be performed. */
@@ -181,11 +276,17 @@ export declare enum TypeInferenceOption {
181
276
  /** Preprocesses the file by injecting returns to extract more type info from sourcekitten. */
182
277
  PREPROCESS_AND_INFERENCE = 2
183
278
  }
279
+ /**
280
+ * Defines an input option for extracting type information directly from a raw string of source code.
281
+ */
184
282
  export type StringInputOption = {
185
283
  type: 'string';
186
284
  fileContent: string;
187
285
  language: 'Swift';
188
286
  };
287
+ /**
288
+ * Defines an input option for extracting type information from a set of physical files.
289
+ */
189
290
  export type FileInputOption = {
190
291
  type: 'file';
191
292
  inputFileAbsolutePaths: string[];
@@ -199,11 +300,13 @@ export type GetFileTypeInformationOptions = {
199
300
  /** The desired level of type inference. Defaults to PREPROCESS_AND_INFERENCE if omitted. */
200
301
  typeInference?: TypeInferenceOption;
201
302
  };
303
+ export declare function withPreparedSingleFile<T>({ input, typeInference }: GetFileTypeInformationOptions, fn: (filePath: string) => Promise<T>): Promise<T>;
202
304
  /**
203
305
  * Reads and extracts `FileTypeInformation` from either a provided file path or a raw string of source code.
204
306
  * If a raw string is provided, or if the `PREPROCESS_AND_INFERENCE` inference option is selected,
205
307
  * the function will create a temporary file with the (optionally preprocessed) content to facilitate parsing.
206
308
  * @param options - Configuration object containing the input source (file or string) and the desired level of type inference.
207
- * @returns A promise that resolves to a `FileTypeInformation` object if the input was parsed successfully. Otherwise, it returns `null`.
309
+ * @returns A promise that resolves to a `FileTypeInformation` object if the input was parsed successfully. Otherwise, it resolves to `null`.
310
+ * @header TypeInformationAbstraction
208
311
  */
209
312
  export declare function getFileTypeInformation({ input, typeInference, }: GetFileTypeInformationOptions): Promise<FileTypeInformation | null>;
@@ -36,12 +36,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.TypeInferenceOption = exports.BasicType = exports.TypeKind = exports.IdentifierKind = void 0;
37
37
  exports.serializeTypeInformation = serializeTypeInformation;
38
38
  exports.deserializeTypeInformation = deserializeTypeInformation;
39
+ exports.withPreparedSingleFile = withPreparedSingleFile;
39
40
  exports.getFileTypeInformation = getFileTypeInformation;
40
41
  const fs = __importStar(require("fs"));
41
42
  const os = __importStar(require("os"));
42
43
  const path = __importStar(require("path"));
43
44
  const sourcekittenTypeInformation_1 = require("./swift/sourcekittenTypeInformation");
44
45
  const utils_1 = require("./utils");
46
+ /**
47
+ * Represents the kind of a parsed identifier from a native file.
48
+ */
45
49
  var IdentifierKind;
46
50
  (function (IdentifierKind) {
47
51
  IdentifierKind[IdentifierKind["BASIC"] = 0] = "BASIC";
@@ -49,6 +53,9 @@ var IdentifierKind;
49
53
  IdentifierKind[IdentifierKind["RECORD"] = 2] = "RECORD";
50
54
  IdentifierKind[IdentifierKind["CLASS"] = 3] = "CLASS";
51
55
  })(IdentifierKind || (exports.IdentifierKind = IdentifierKind = {}));
56
+ /**
57
+ * Categorizes the type node within the abstract syntax tree.
58
+ */
52
59
  var TypeKind;
53
60
  (function (TypeKind) {
54
61
  TypeKind[TypeKind["BASIC"] = 0] = "BASIC";
@@ -59,6 +66,9 @@ var TypeKind;
59
66
  TypeKind[TypeKind["ARRAY"] = 5] = "ARRAY";
60
67
  TypeKind[TypeKind["DICTIONARY"] = 6] = "DICTIONARY";
61
68
  })(TypeKind || (exports.TypeKind = TypeKind = {}));
69
+ /**
70
+ * Represents a basic type that is not user defined.
71
+ */
62
72
  var BasicType;
63
73
  (function (BasicType) {
64
74
  BasicType[BasicType["ANY"] = 0] = "ANY";
@@ -67,12 +77,14 @@ var BasicType;
67
77
  BasicType[BasicType["BOOLEAN"] = 3] = "BOOLEAN";
68
78
  BasicType[BasicType["VOID"] = 4] = "VOID";
69
79
  BasicType[BasicType["UNDEFINED"] = 5] = "UNDEFINED";
80
+ /** Represents a type that couldn't be resolved */
70
81
  BasicType[BasicType["UNRESOLVED"] = 6] = "UNRESOLVED";
71
82
  })(BasicType || (exports.BasicType = BasicType = {}));
72
83
  /**
73
- * Used for testing purposes, maps Sets and Maps to Arrays and returns FileTypeInformationSerialized object which can be written to a JSON.
74
- * @param param0 FileTypeInformation object to serialize.
75
- * @returns FileTypeInformationSerialized object.
84
+ * Used for testing purposes, maps Sets and Maps to Arrays and returns `FileTypeInformationSerialized` object which can be written to a JSON.
85
+ * @param fileTypeinformation `FileTypeInformation` object to serialize.
86
+ * @returns a `FileTypeInformationSerialized` object.
87
+ * @header TypeInformationAbstraction
76
88
  */
77
89
  function serializeTypeInformation({ usedTypeIdentifiers, declaredTypeIdentifiers, inferredTypeParametersCount, typeIdentifierDefinitionMap, moduleClasses, records, enums, }) {
78
90
  return {
@@ -86,9 +98,10 @@ function serializeTypeInformation({ usedTypeIdentifiers, declaredTypeIdentifiers
86
98
  };
87
99
  }
88
100
  /**
89
- * Used for testing purposes, maps Arrays to Sets and Maps depending on the field and returns FileTypeInformation object.
90
- * @param param0 FileTypeInformationSerialized object to deserialize.
91
- * @returns FileTypeInformation object.
101
+ * Used for testing purposes, maps Arrays to Sets and Maps depending on the field and returns `FileTypeInformation` object.
102
+ * @param fileTypeinformationSerialized `FileTypeInformationSerialized` object to deserialize.
103
+ * @returns `FileTypeInformation` object.
104
+ * @header TypeInformationAbstraction
92
105
  */
93
106
  function deserializeTypeInformation({ usedTypeIdentifiersList, declaredTypeIdentifiersList, inferredTypeParametersCountList, typeIdentifierDefinitionList, moduleClasses, records, enums, }) {
94
107
  return {
@@ -103,7 +116,7 @@ function deserializeTypeInformation({ usedTypeIdentifiersList, declaredTypeIdent
103
116
  }
104
117
  /**
105
118
  * Defines the level of type inference to apply when extracting type information.
106
- * Note: In case where type inference is on, it may take more then twice the time to compute the type information.
119
+ * > **Note:** In case where type inference is on, it may take more then twice the time to compute the type information.
107
120
  */
108
121
  var TypeInferenceOption;
109
122
  (function (TypeInferenceOption) {
@@ -129,12 +142,26 @@ async function withTempFile(content, fn) {
129
142
  await fs.promises.rm(tempDir, { recursive: true, force: true });
130
143
  }
131
144
  }
145
+ async function withPreparedSingleFile({ input, typeInference }, fn) {
146
+ const shouldPreprocessFile = typeInference === TypeInferenceOption.PREPROCESS_AND_INFERENCE;
147
+ if (!shouldPreprocessFile && input.type === 'file' && input.inputFileAbsolutePaths.length === 0) {
148
+ return fn(input.inputFileAbsolutePaths[0]);
149
+ }
150
+ const fileContent = input.type === 'file'
151
+ ? await mergeFileContents(input.inputFileAbsolutePaths)
152
+ : input.fileContent;
153
+ if (shouldPreprocessFile) {
154
+ return withTempFile((0, sourcekittenTypeInformation_1.preprocessSwiftFile)(fileContent), fn);
155
+ }
156
+ return withTempFile(fileContent, fn);
157
+ }
132
158
  /**
133
159
  * Reads and extracts `FileTypeInformation` from either a provided file path or a raw string of source code.
134
160
  * If a raw string is provided, or if the `PREPROCESS_AND_INFERENCE` inference option is selected,
135
161
  * the function will create a temporary file with the (optionally preprocessed) content to facilitate parsing.
136
162
  * @param options - Configuration object containing the input source (file or string) and the desired level of type inference.
137
- * @returns A promise that resolves to a `FileTypeInformation` object if the input was parsed successfully. Otherwise, it returns `null`.
163
+ * @returns A promise that resolves to a `FileTypeInformation` object if the input was parsed successfully. Otherwise, it resolves to `null`.
164
+ * @header TypeInformationAbstraction
138
165
  */
139
166
  async function getFileTypeInformation({ input, typeInference, }) {
140
167
  const shouldPreprocessFile = typeInference === TypeInferenceOption.PREPROCESS_AND_INFERENCE;
@@ -144,14 +171,8 @@ async function getFileTypeInformation({ input, typeInference, }) {
144
171
  typeInference: typeInferenceOn,
145
172
  });
146
173
  }
147
- const fileContent = input.type === 'file'
148
- ? await mergeFileContents(input.inputFileAbsolutePaths)
149
- : input.fileContent;
150
- const preprocessedContent = shouldPreprocessFile ? (0, sourcekittenTypeInformation_1.preprocessSwiftFile)(fileContent) : fileContent;
151
- return withTempFile(preprocessedContent, async (tempFilePath) => {
152
- return (0, sourcekittenTypeInformation_1.getSwiftFileTypeInformation)(tempFilePath, {
153
- typeInference: typeInferenceOn,
154
- });
174
+ return withPreparedSingleFile({ input, typeInference }, async (tempFilePath) => {
175
+ return (0, sourcekittenTypeInformation_1.getSwiftFileTypeInformation)(tempFilePath, { typeInference: typeInferenceOn });
155
176
  });
156
177
  }
157
178
  //# sourceMappingURL=typeInformation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeInformation.js","sourceRoot":"","sources":["../src/typeInformation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoMA,4DAkBC;AAOD,gEAkBC;AA8DD,wDAwBC;AArUD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAE7B,qFAG6C;AAC7C,mCAAkC;AAElC,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,qDAAK,CAAA;IACL,mDAAI,CAAA;IACJ,uDAAM,CAAA;IACN,qDAAK,CAAA;AACP,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB;AAoCD,IAAY,QAQX;AARD,WAAY,QAAQ;IAClB,yCAAK,CAAA;IACL,mDAAU,CAAA;IACV,qCAAG,CAAA;IACH,uDAAY,C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AAa,EAAE,eAAe;SAC/B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,sBAAsB,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;QAC7E,OAAO,IAAA,yDAA2B,EAAC,YAAY,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,7 +1,16 @@
1
1
  import ts from 'typescript';
2
2
  import { ClassDeclaration, ConstructorDeclaration, EnumType, FileTypeInformation, FunctionDeclaration, ModuleClassDeclaration, RecordType, Type, ViewDeclaration } from './typeInformation';
3
+ /**
4
+ * A helper type which contains the generated file content and name.
5
+ */
3
6
  export type OutputFile = {
7
+ /**
8
+ * @field Generated file content.
9
+ */
4
10
  content: string;
11
+ /**
12
+ * @field Generated file base name (e.g. `ExpoSettings.types.ts`).
13
+ */
5
14
  name: string;
6
15
  };
7
16
  export interface GenerationContext {
@@ -44,14 +53,55 @@ export declare function buildExposedTypesDeclarations(ctx: GenerationContext, op
44
53
  declare?: boolean;
45
54
  }): ts.Node[];
46
55
  export declare function getViewPropsTypeName(view: ViewDeclaration): string;
56
+ /**
57
+ * Helper function that takes a file content string and formats it using `prettier` formatter.
58
+ * @param text Content of a JavaScript/TypeScript file to format.
59
+ * @param parser An option of which parser to use to format the file.
60
+ * @default "babel"
61
+ * @returns A promise which resolves to the `text` string after formatting using `prettier` with the given `parser`.
62
+ * @header TypescriptGeneration
63
+ */
47
64
  export declare function prettifyCode(text: string, parser?: 'babel' | 'typescript'): Promise<string>;
65
+ /**
66
+ * Generates the TypeScript string content for a native View's type declaration file.
67
+ * @param fileTypeInformation The abstracted type information of an Expo module.
68
+ * @returns A promise that resolves to a string containing the TypeScript declaration file content or `null` if the generation has failed.
69
+ * @header TypescriptGeneration
70
+ */
48
71
  export declare function generateViewTypesFileContent(fileTypeInformation: FileTypeInformation): Promise<string | null>;
72
+ /**
73
+ * Generates the TypeScript string content for a native View's type declaration file which mounts the View props on the global `JSXIntrinsics`.
74
+ * @param fileTypeInformation The abstracted type information of an Expo module.
75
+ * @returns A promise that resolves to a string containing the TypeScript declaration file content or `null` if the generation has failed.
76
+ * @header TypescriptGeneration
77
+ */
49
78
  export declare function generateJSXIntrinsicsFileContent(fileTypeInformation: FileTypeInformation): Promise<string | null>;
79
+ /**
80
+ * Generates the TypeScript string content for a native module type declaration file.
81
+ * @param fileTypeInformation The abstracted type information of an Expo module.
82
+ * @returns A promise that resolves to a string containing the TypeScript module declaration file content or `null` if the generation has failed.
83
+ * @header TypescriptGeneration
84
+ */
50
85
  export declare function generateModuleTypesFileContent(fileTypeInformation: FileTypeInformation): Promise<string | null>;
86
+ /**
87
+ * Generates a short TypeScript interface for an Expo module. This creates the content for two files: a volatile generated file containing raw type definitions,
88
+ * and a stable user-facing file that wraps and exports the native module methods in new functions.
89
+ * @param fileTypeInformation The abstracted type information of an Expo module.
90
+ * @returns A promise that resolves to an object containing the string contents for both the volatile generated file and the stable TypeScript interface file.
91
+ * @header TypescriptGeneration
92
+ */
51
93
  export declare function generateConciseTsInterface(fileTypeInformation: FileTypeInformation): Promise<{
52
94
  volatileGeneratedFileContent: string;
53
95
  moduleTypescriptInterfaceFileContent: string;
54
96
  }>;
97
+ /**
98
+ * Generates a full, multi-file TypeScript interface for an Expo module.
99
+ * The generated interface is separated into a file with type definitions, a file which wraps the native module, a file for each view defined in a module and an index file which reexports all definitions from the other files.
100
+ *
101
+ * @param fileTypeInformation The abstracted type information of an Expo module.
102
+ * @returns A promise that resolves to an object containing the string contents for all of the generated files or `null` if the generation has failed.
103
+ * @header TypescriptGeneration
104
+ */
55
105
  export declare function generateFullTsInterface(fileTypeInformation: FileTypeInformation): Promise<{
56
106
  moduleTypesFile: OutputFile;
57
107
  moduleViewsFiles: OutputFile[];
@@ -374,7 +374,7 @@ function buildRecordTypeAlias(recordType, exported) {
374
374
  });
375
375
  }
376
376
  function buildEnumTypeDeclaration(enumType, exported, declared) {
377
- return typescript_1.default.factory.createEnumDeclaration(constructModifiersArray({ exported, declare: declared }), enumType.name, enumType.cases.map((enumcase) => typescript_1.default.factory.createEnumMember(enumcase)));
377
+ return typescript_1.default.factory.createEnumDeclaration(constructModifiersArray({ exported, declare: declared }), enumType.name, enumType.cases.map((enumcase) => typescript_1.default.factory.createEnumMember(enumcase, typescript_1.default.factory.createStringLiteral(enumcase))));
378
378
  }
379
379
  function buildMissingTypesDeclarations(ctx) {
380
380
  if (ctx.missingTypes.size === 0) {
@@ -557,6 +557,14 @@ async function tsNodesToString(elements) {
557
557
  const printedTs = printer.printList(typescript_1.default.ListFormat.MultiLine | typescript_1.default.ListFormat.PreserveLines, viewTypes, resultFile);
558
558
  return await prettifyCode(printedTs, 'typescript');
559
559
  }
560
+ /**
561
+ * Helper function that takes a file content string and formats it using `prettier` formatter.
562
+ * @param text Content of a JavaScript/TypeScript file to format.
563
+ * @param parser An option of which parser to use to format the file.
564
+ * @default "babel"
565
+ * @returns A promise which resolves to the `text` string after formatting using `prettier` with the given `parser`.
566
+ * @header TypescriptGeneration
567
+ */
560
568
  async function prettifyCode(text, parser = 'babel') {
561
569
  return await prettier_1.default.format(text, {
562
570
  parser,
@@ -566,6 +574,12 @@ async function prettifyCode(text, parser = 'babel') {
566
574
  singleQuote: true,
567
575
  });
568
576
  }
577
+ /**
578
+ * Generates the TypeScript string content for a native View's type declaration file.
579
+ * @param fileTypeInformation The abstracted type information of an Expo module.
580
+ * @returns A promise that resolves to a string containing the TypeScript declaration file content or `null` if the generation has failed.
581
+ * @header TypescriptGeneration
582
+ */
569
583
  async function generateViewTypesFileContent(fileTypeInformation) {
570
584
  const ctx = createDefaultGenerationContext(fileTypeInformation);
571
585
  if (!ctx) {
@@ -573,6 +587,12 @@ async function generateViewTypesFileContent(fileTypeInformation) {
573
587
  }
574
588
  return tsNodesToString(buildViewDeclarationNodes(ctx));
575
589
  }
590
+ /**
591
+ * Generates the TypeScript string content for a native View's type declaration file which mounts the View props on the global `JSXIntrinsics`.
592
+ * @param fileTypeInformation The abstracted type information of an Expo module.
593
+ * @returns A promise that resolves to a string containing the TypeScript declaration file content or `null` if the generation has failed.
594
+ * @header TypescriptGeneration
595
+ */
576
596
  async function generateJSXIntrinsicsFileContent(fileTypeInformation) {
577
597
  const ctx = createDefaultGenerationContext(fileTypeInformation);
578
598
  if (!ctx) {
@@ -580,6 +600,12 @@ async function generateJSXIntrinsicsFileContent(fileTypeInformation) {
580
600
  }
581
601
  return tsNodesToString(buildJSXIntrinsicsViewNodes(ctx));
582
602
  }
603
+ /**
604
+ * Generates the TypeScript string content for a native module type declaration file.
605
+ * @param fileTypeInformation The abstracted type information of an Expo module.
606
+ * @returns A promise that resolves to a string containing the TypeScript module declaration file content or `null` if the generation has failed.
607
+ * @header TypescriptGeneration
608
+ */
583
609
  async function generateModuleTypesFileContent(fileTypeInformation) {
584
610
  const ctx = createDefaultGenerationContext(fileTypeInformation);
585
611
  if (!ctx) {
@@ -587,6 +613,13 @@ async function generateModuleTypesFileContent(fileTypeInformation) {
587
613
  }
588
614
  return tsNodesToString(buildModuleDeclarationNodes(ctx));
589
615
  }
616
+ /**
617
+ * Generates a short TypeScript interface for an Expo module. This creates the content for two files: a volatile generated file containing raw type definitions,
618
+ * and a stable user-facing file that wraps and exports the native module methods in new functions.
619
+ * @param fileTypeInformation The abstracted type information of an Expo module.
620
+ * @returns A promise that resolves to an object containing the string contents for both the volatile generated file and the stable TypeScript interface file.
621
+ * @header TypescriptGeneration
622
+ */
590
623
  async function generateConciseTsInterface(fileTypeInformation) {
591
624
  const ctx = createDefaultGenerationContext(fileTypeInformation);
592
625
  if (!ctx) {
@@ -599,6 +632,14 @@ async function generateConciseTsInterface(fileTypeInformation) {
599
632
  moduleTypescriptInterfaceFileContent,
600
633
  };
601
634
  }
635
+ /**
636
+ * Generates a full, multi-file TypeScript interface for an Expo module.
637
+ * The generated interface is separated into a file with type definitions, a file which wraps the native module, a file for each view defined in a module and an index file which reexports all definitions from the other files.
638
+ *
639
+ * @param fileTypeInformation The abstracted type information of an Expo module.
640
+ * @returns A promise that resolves to an object containing the string contents for all of the generated files or `null` if the generation has failed.
641
+ * @header TypescriptGeneration
642
+ */
602
643
  async function generateFullTsInterface(fileTypeInformation) {
603
644
  const ctx = createDefaultGenerationContext(fileTypeInformation);
604
645
  if (!ctx) {