@ts-for-gir/cli 3.0.0-beta.7 → 3.0.0-beta.9

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 (162) hide show
  1. package/README.md +318 -63
  2. package/lib/commands/generate.d.ts +5 -5
  3. package/lib/commands/generate.js +5 -5
  4. package/lib/commands/generate.js.map +1 -1
  5. package/lib/config.d.ts +7 -24
  6. package/lib/config.js +69 -50
  7. package/lib/config.js.map +1 -1
  8. package/lib/constants.d.ts +1 -1
  9. package/lib/constants.js +1 -1
  10. package/lib/constants.js.map +1 -1
  11. package/lib/dependency-manager.d.ts +34 -0
  12. package/lib/dependency-manager.js +78 -0
  13. package/lib/dependency-manager.js.map +1 -0
  14. package/lib/generation-handler.js +2 -2
  15. package/lib/generation-handler.js.map +1 -1
  16. package/lib/gir-module.d.ts +7 -6
  17. package/lib/gir-module.js +34 -23
  18. package/lib/gir-module.js.map +1 -1
  19. package/lib/messages.d.ts +4 -3
  20. package/lib/messages.js +4 -3
  21. package/lib/messages.js.map +1 -1
  22. package/lib/module-loader.d.ts +11 -8
  23. package/lib/module-loader.js +53 -50
  24. package/lib/module-loader.js.map +1 -1
  25. package/lib/symtable.d.ts +4 -4
  26. package/lib/symtable.js +1 -1
  27. package/lib/symtable.js.map +1 -1
  28. package/lib/template-processor.d.ts +37 -9
  29. package/lib/template-processor.js +79 -68
  30. package/lib/template-processor.js.map +1 -1
  31. package/lib/type-definition-generator.js +34 -26
  32. package/lib/type-definition-generator.js.map +1 -1
  33. package/lib/types/class-parent.d.ts +2 -0
  34. package/lib/types/dependency-map.d.ts +1 -1
  35. package/lib/types/dependency.d.ts +2 -1
  36. package/lib/types/file-info.d.ts +14 -0
  37. package/lib/types/file-info.js +2 -0
  38. package/lib/types/file-info.js.map +1 -0
  39. package/lib/types/generate-config.d.ts +6 -6
  40. package/lib/types/index.d.ts +1 -0
  41. package/lib/types/index.js +1 -0
  42. package/lib/types/index.js.map +1 -1
  43. package/lib/types/promisify-func.d.ts +5 -0
  44. package/lib/types/promisify-func.js +2 -0
  45. package/lib/types/promisify-func.js.map +1 -0
  46. package/lib/types/user-config.d.ts +6 -6
  47. package/lib/utils.d.ts +196 -7
  48. package/lib/utils.js +201 -19
  49. package/lib/utils.js.map +1 -1
  50. package/package.json +28 -14
  51. package/src/commands/generate.ts +5 -5
  52. package/src/config.ts +95 -68
  53. package/src/constants.ts +1 -1
  54. package/src/dependency-manager.ts +91 -0
  55. package/src/generation-handler.ts +2 -2
  56. package/src/gir-module.ts +43 -32
  57. package/src/messages.ts +4 -3
  58. package/src/module-loader.ts +59 -54
  59. package/src/symtable.ts +8 -6
  60. package/src/template-processor.ts +101 -72
  61. package/src/type-definition-generator.ts +36 -28
  62. package/src/types/class-parent.ts +2 -0
  63. package/src/types/dependency-map.ts +1 -1
  64. package/src/types/dependency.ts +3 -1
  65. package/src/types/file-info.ts +14 -0
  66. package/src/types/generate-config.ts +6 -6
  67. package/src/types/index.ts +1 -0
  68. package/src/types/user-config.ts +6 -6
  69. package/src/utils.ts +203 -20
  70. package/templates/Gjs/Gjs.d.ts +75 -8
  71. package/templates/Gjs/GnomeShell.d.ts +70 -36
  72. package/templates/Gjs/index.d.ts +9 -5
  73. package/templates/Gjs/misc/dbusUtils.d.ts +15 -0
  74. package/templates/Gjs/misc/dbusUtils.js +6 -0
  75. package/templates/Gjs/misc/fileUtils.d.ts +51 -0
  76. package/templates/Gjs/misc/fileUtils.js +6 -0
  77. package/templates/Gjs/misc/gnomeSession.d.ts +74 -0
  78. package/templates/Gjs/misc/gnomeSession.js +6 -0
  79. package/templates/Gjs/misc/parentalControlsManager.d.ts +42 -0
  80. package/templates/Gjs/misc/parentalControlsManager.js +6 -0
  81. package/templates/Gjs/misc/signals.d.ts +15 -0
  82. package/templates/Gjs/misc/signals.js +6 -0
  83. package/templates/Gjs/module.d.ts +0 -4
  84. package/templates/Gjs/module.js +1 -1
  85. package/templates/Gjs/tsconfig.alias.json +10 -0
  86. package/templates/Gjs/ui/accessDialog.d.ts +19 -0
  87. package/templates/Gjs/ui/accessDialog.js +6 -0
  88. package/templates/Gjs/ui/altTab.d.ts +124 -0
  89. package/templates/Gjs/ui/altTab.js +6 -0
  90. package/templates/Gjs/ui/animation.d.ts +58 -0
  91. package/templates/Gjs/ui/animation.js +6 -0
  92. package/templates/Gjs/ui/appDisplay.d.ts +204 -0
  93. package/templates/Gjs/ui/appDisplay.js +6 -0
  94. package/templates/Gjs/ui/appFavorites.d.ts +34 -0
  95. package/templates/Gjs/ui/appFavorites.js +6 -0
  96. package/templates/Gjs/ui/appMenu.d.ts +74 -0
  97. package/templates/Gjs/ui/appMenu.js +6 -0
  98. package/templates/Gjs/ui/audioDeviceSelection.d.ts +51 -0
  99. package/templates/Gjs/ui/audioDeviceSelection.js +6 -0
  100. package/templates/Gjs/ui/background.d.ts +255 -0
  101. package/templates/Gjs/ui/background.js +5 -0
  102. package/templates/Gjs/ui/backgroundMenu.d.ts +19 -0
  103. package/templates/Gjs/ui/backgroundMenu.js +5 -0
  104. package/templates/Gjs/ui/barLevel.d.ts +42 -0
  105. package/templates/Gjs/ui/barLevel.js +5 -0
  106. package/templates/Gjs/ui/boxpointer.d.ts +103 -0
  107. package/templates/Gjs/ui/boxpointer.js +5 -0
  108. package/templates/Gjs/ui/calendar.d.ts +261 -0
  109. package/templates/Gjs/ui/calendar.js +5 -0
  110. package/templates/Gjs/ui/components/__init__.d.ts +9 -0
  111. package/templates/Gjs/ui/components/__init__.js +6 -0
  112. package/templates/Gjs/ui/components/automountManager.d.ts +8 -0
  113. package/templates/Gjs/ui/components/automountManager.js +6 -0
  114. package/templates/Gjs/ui/components/autorunManager.d.ts +8 -0
  115. package/templates/Gjs/ui/components/autorunManager.js +6 -0
  116. package/templates/Gjs/ui/components/index.d.ts +6 -0
  117. package/templates/Gjs/ui/components/index.js +6 -0
  118. package/templates/Gjs/ui/components/keyring.d.ts +19 -0
  119. package/templates/Gjs/ui/components/keyring.js +6 -0
  120. package/templates/Gjs/ui/components/networkAgent.d.ts +10 -0
  121. package/templates/Gjs/ui/components/networkAgent.js +6 -0
  122. package/templates/Gjs/ui/components/polkitAgent.d.ts +19 -0
  123. package/templates/Gjs/ui/components/polkitAgent.js +6 -0
  124. package/templates/Gjs/ui/components/telepathyClient.d.ts +10 -0
  125. package/templates/Gjs/ui/components/telepathyClient.js +6 -0
  126. package/templates/Gjs/ui/dialog.d.ts +78 -0
  127. package/templates/Gjs/ui/dialog.js +0 -0
  128. package/templates/Gjs/ui/dnd.d.ts +127 -0
  129. package/templates/Gjs/ui/dnd.js +6 -0
  130. package/templates/Gjs/ui/iconGrid.d.ts +172 -0
  131. package/templates/Gjs/ui/iconGrid.js +6 -0
  132. package/templates/Gjs/ui/layout.d.ts +311 -0
  133. package/templates/Gjs/ui/layout.js +6 -0
  134. package/templates/Gjs/ui/main.d.ts +215 -0
  135. package/templates/Gjs/ui/main.js +6 -0
  136. package/templates/Gjs/ui/messageList.d.ts +113 -0
  137. package/templates/Gjs/ui/messageList.js +6 -0
  138. package/templates/Gjs/ui/messageTray.d.ts +423 -0
  139. package/templates/Gjs/ui/messageTray.js +6 -0
  140. package/templates/Gjs/ui/modalDialog.d.ts +96 -0
  141. package/templates/Gjs/ui/modalDialog.js +6 -0
  142. package/templates/Gjs/ui/mpris.d.ts +78 -0
  143. package/templates/Gjs/ui/mpris.js +6 -0
  144. package/templates/Gjs/ui/notificationDaemon.d.ts +5 -0
  145. package/templates/Gjs/ui/notificationDaemon.js +6 -0
  146. package/templates/Gjs/ui/panel.d.ts +65 -0
  147. package/templates/Gjs/ui/panel.js +6 -0
  148. package/templates/Gjs/ui/panelMenu.d.ts +51 -0
  149. package/templates/Gjs/ui/panelMenu.js +6 -0
  150. package/templates/Gjs/ui/popupMenu.d.ts +228 -0
  151. package/templates/Gjs/ui/popupMenu.js +6 -0
  152. package/templates/Gjs/ui/ripples.d.ts +44 -0
  153. package/templates/Gjs/ui/ripples.js +6 -0
  154. package/templates/Gjs/ui/search.d.ts +158 -0
  155. package/templates/Gjs/ui/search.js +6 -0
  156. package/templates/Gjs/ui/switcherPopup.d.ts +107 -0
  157. package/templates/Gjs/ui/switcherPopup.js +6 -0
  158. package/templates/Gjs/ui/userWidget.d.ts +13 -0
  159. package/templates/Gjs/ui/userWidget.js +6 -0
  160. package/templates/node-gtk/index.d.ts +3 -3
  161. package/templates/node-gtk/module.d.ts +0 -4
  162. package/templates/node-gtk/module.js +1 -1
package/lib/utils.d.ts CHANGED
@@ -1,8 +1,49 @@
1
1
  import lodash from 'lodash';
2
- import { Environment, GirInfoAttrs, TsType } from './types/index.js';
2
+ import { Environment, GirInfoAttrs, TsType, FileInfo } from './types/index.js';
3
3
  import { inspect } from 'util';
4
4
  export { inspect };
5
+ /**
6
+ * Performs a deep comparison between two values to determine if they are
7
+ * equivalent.
8
+ *
9
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
10
+ * date objects, error objects, maps, numbers, `Object` objects, regexes,
11
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
12
+ * by their own, not inherited, enumerable properties. Functions and DOM
13
+ * nodes are **not** supported.
14
+ *
15
+ * @category Lang
16
+ * @param value The value to compare.
17
+ * @param other The other value to compare.
18
+ * @returns Returns `true` if the values are equivalent, else `false`.
19
+ * @example
20
+ *
21
+ * var object = { 'user': 'fred' };
22
+ * var other = { 'user': 'fred' };
23
+ *
24
+ * _.isEqual(object, other);
25
+ * // => true
26
+ *
27
+ * object === other;
28
+ * // => false
29
+ */
5
30
  export declare const isEqual: (value: any, other: any) => boolean;
31
+ /**
32
+ * Creates an array of values by running each element in collection through iteratee. The iteratee is
33
+ * invoked with three arguments: (value, index|key, collection).
34
+ *
35
+ * Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues,
36
+ * _.reject, and _.some.
37
+ *
38
+ * The guarded methods are:
39
+ * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max,
40
+ * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range,
41
+ * sample, some, sum, uniq, and words
42
+ *
43
+ * @param collection The collection to iterate over.
44
+ * @param iteratee The function invoked per iteration.
45
+ * @return Returns the new mapped array.
46
+ */
6
47
  export declare const map: {
7
48
  <T, TResult>(collection: T[] | null | undefined, iteratee: lodash.ArrayIterator<T, TResult>): TResult[];
8
49
  <T_1, TResult_1>(collection: lodash.List<T_1> | null | undefined, iteratee: lodash.ListIterator<T_1, TResult_1>): TResult_1[];
@@ -12,12 +53,48 @@ export declare const map: {
12
53
  <T_5>(collection: lodash.Dictionary<T_5> | lodash.NumericDictionary<T_5> | null | undefined, iteratee?: string | undefined): any[];
13
54
  <T_6>(collection: lodash.Dictionary<T_6> | lodash.NumericDictionary<T_6> | null | undefined, iteratee?: object | undefined): boolean[];
14
55
  };
56
+ /**
57
+ * Iterates over elements of collection, returning the first element predicate returns truthy for.
58
+ * The predicate is invoked with three arguments: (value, index|key, collection).
59
+ *
60
+ * @param collection The collection to search.
61
+ * @param predicate The function invoked per iteration.
62
+ * @param fromIndex The index to search from.
63
+ * @return Returns the matched element, else undefined.
64
+ */
15
65
  export declare const find: {
16
66
  <T, S extends T>(collection: lodash.List<T> | null | undefined, predicate: lodash.ListIteratorTypeGuard<T, S>, fromIndex?: number | undefined): S | undefined;
17
67
  <T_1>(collection: lodash.List<T_1> | null | undefined, predicate?: lodash.ListIterateeCustom<T_1, boolean> | undefined, fromIndex?: number | undefined): T_1 | undefined;
18
68
  <T_2 extends object, S_1 extends T_2[keyof T_2]>(collection: T_2 | null | undefined, predicate: lodash.ObjectIteratorTypeGuard<T_2, S_1>, fromIndex?: number | undefined): S_1 | undefined;
19
69
  <T_3 extends object>(collection: T_3 | null | undefined, predicate?: lodash.ObjectIterateeCustom<T_3, boolean> | undefined, fromIndex?: number | undefined): T_3[keyof T_3] | undefined;
20
70
  };
71
+ /**
72
+ * Recursively merges own and inherited enumerable properties of source
73
+ * objects into the destination object, skipping source properties that resolve
74
+ * to `undefined`. Array and plain object properties are merged recursively.
75
+ * Other objects and value types are overridden by assignment. Source objects
76
+ * are applied from left to right. Subsequent sources overwrite property
77
+ * assignments of previous sources.
78
+ *
79
+ * **Note:** This method mutates `object`.
80
+ *
81
+ * @category Object
82
+ * @param object The destination object.
83
+ * @param [sources] The source objects.
84
+ * @returns Returns `object`.
85
+ * @example
86
+ *
87
+ * var users = {
88
+ * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
89
+ * };
90
+ *
91
+ * var ages = {
92
+ * 'data': [{ 'age': 36 }, { 'age': 40 }]
93
+ * };
94
+ *
95
+ * _.merge(users, ages);
96
+ * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
97
+ */
21
98
  export declare const merge: {
22
99
  <TObject, TSource>(object: TObject, source: TSource): TObject & TSource;
23
100
  <TObject_1, TSource1, TSource2>(object: TObject_1, source1: TSource1, source2: TSource2): TObject_1 & TSource1 & TSource2;
@@ -25,8 +102,28 @@ export declare const merge: {
25
102
  <TObject_3, TSource1_2, TSource2_2, TSource3_1, TSource4>(object: TObject_3, source1: TSource1_2, source2: TSource2_2, source3: TSource3_1, source4: TSource4): TObject_3 & TSource1_2 & TSource2_2 & TSource3_1 & TSource4;
26
103
  (object: any, ...otherArgs: any[]): any;
27
104
  };
105
+ /**
106
+ * Creates a shallow clone of value.
107
+ *
108
+ * Note: This method is loosely based on the structured clone algorithm and supports cloning arrays,
109
+ * array buffers, booleans, date objects, maps, numbers, Object objects, regex's, sets, strings, symbols,
110
+ * and typed arrays. The own enumerable properties of arguments objects are cloned as plain objects. An empty
111
+ * object is returned for not cloneable values such as error objects, functions, DOM nodes, and WeakMaps.
112
+ *
113
+ * @param value The value to clone.
114
+ * @return Returns the cloned value.
115
+ */
28
116
  export declare const clone: <T>(value: T) => T;
117
+ /**
118
+ * This method is like clone except that it recursively clones value.
119
+ *
120
+ * @param value The value to recursively clone.
121
+ * @return Returns the deep cloned value.
122
+ */
29
123
  export declare const cloneDeep: <T>(value: T) => T;
124
+ /**
125
+ * Split a package name into namespace and version
126
+ */
30
127
  export declare const splitModuleName: (packageName: string) => {
31
128
  packageName: string;
32
129
  namespace: string;
@@ -36,24 +133,66 @@ export declare const splitModuleName: (packageName: string) => {
36
133
  export declare const removeNamespace: (type: string, namespace: string) => string;
37
134
  /** Remove class module name prefix */
38
135
  export declare const removeClassModule: (type: string, namespace: string) => string;
136
+ /**
137
+ * Add namespace prefix
138
+ */
39
139
  export declare const addNamespace: (type: string, namespace: string) => string;
40
140
  /**
41
141
  * Checking whether some variable is iterable
42
- * see https://stackoverflow.com/a/32538867
142
+ * @see https://stackoverflow.com/a/32538867
43
143
  * @param obj Variable to check for iterable
144
+ * @returns Whether the variable is iterable or not
44
145
  */
45
146
  export declare const isIterable: (obj: unknown[]) => boolean;
147
+ /**
148
+ * Checking whether a string is numeric
149
+ * @param str The string to check
150
+ * @returns Whether the string is numeric or not
151
+ */
46
152
  export declare const isNumeric: (str: string) => boolean;
153
+ /**
154
+ * Get the first character of a string
155
+ * @param str The string to get the first character from
156
+ * @returns The first character
157
+ */
47
158
  export declare const getFirstChar: (str: string) => string;
159
+ /**
160
+ * Get the last character of a string
161
+ * @param str The string to get the last character from
162
+ * @returns The last character
163
+ */
48
164
  export declare const getLastChar: (str: string) => string;
165
+ /**
166
+ * Check if the first character of a string is numeric
167
+ * @param str The string to check
168
+ * @returns Whether the first character is numeric or not
169
+ */
49
170
  export declare const isFirstCharNumeric: (str: string) => boolean;
171
+ /**
172
+ * Convert a string to camelCase
173
+ * @param str The string to convert
174
+ * @returns The converted string
175
+ */
50
176
  export declare const camelCase: (str: string) => string;
177
+ /**
178
+ * Convert a string to lowerCamelCase
179
+ * @param str The string to convert
180
+ * @returns The converted string
181
+ */
51
182
  export declare const lowerCamelCase: (str: string) => string;
183
+ /**
184
+ * Convert a string to UpperCamelCase
185
+ * @param str The string to convert
186
+ * @returns The converted string
187
+ */
52
188
  export declare const upperCamelCase: (str: string) => string;
53
- export declare const findFileInDirs: (dirs: string[], filename: string) => {
54
- path: string | null;
55
- exists: boolean;
56
- };
189
+ /**
190
+ * Find a file in a list of directories
191
+ * @param dirs The directories to search in
192
+ * @param filename The filename to search for
193
+ * @returns The file info
194
+ */
195
+ export declare const findFileInDirs: (dirs: string[], filename: string) => FileInfo;
57
196
  /**
58
197
  * Union (a ∪ b): create a set that contains the elements of both set a and set b.
59
198
  * See https://2ality.com/2015/01/es6-set-operations.html#union
@@ -62,12 +201,42 @@ export declare const findFileInDirs: (dirs: string[], filename: string) => {
62
201
  */
63
202
  export declare const union: <T>(target: Set<T> | T[], source: Set<T> | T[]) => Set<T>;
64
203
  export declare const stripParamNames: (func: string, ignoreTail?: boolean) => string;
204
+ /**
205
+ * Check if a line is a comment line
206
+ * @param line The line to check
207
+ * @returns Whether the line is a comment line or not
208
+ */
65
209
  export declare const isCommentLine: (line: string) => boolean;
210
+ /**
211
+ * Add indents to a string
212
+ * @param indents The number of indents
213
+ * @param spaceForIndent The number of spaces for each indent
214
+ * @returns The indented string
215
+ */
66
216
  export declare const generateIndent: (indents?: number, spaceForIndent?: number) => string;
67
217
  export declare const __filename: string;
68
218
  export declare const __dirname: string;
219
+ /**
220
+ * Get the output or input directory of the environment
221
+ * @param environment The environment to get the directory for
222
+ * @param baseDir The base directory
223
+ * @returns The path to the directory
224
+ */
69
225
  export declare const getEnvironmentDir: (environment: Environment, baseDir: string) => string;
70
- export declare const getDestPath: (environment: Environment, outputDir: string, outputFilename: string) => string;
226
+ /**
227
+ * Get the destination path for the environment
228
+ * @param environment The environment to get the destination path for
229
+ * @param outputDir The output directory
230
+ * @param parts The path parts
231
+ * @returns The destination path
232
+ */
233
+ export declare const getDestPath: (environment: Environment, outputDir: string, ...parts: string[]) => string;
234
+ /**
235
+ * Convert a GirBoolean to a boolean
236
+ * @param boolStr The GirBoolean string
237
+ * @param defaultVal The default value
238
+ * @returns The boolean value
239
+ */
71
240
  export declare const girBool: (boolStr: string | undefined, defaultVal?: boolean) => boolean;
72
241
  /**
73
242
  * Returns `true` if the definitions in `d1` and `d2` have equivalent signatures
@@ -85,7 +254,27 @@ export declare const girElementIsIntrospectable: (girElement?: {
85
254
  name: string;
86
255
  };
87
256
  } | undefined, name?: string) => boolean;
257
+ /**
258
+ * Check if a type is optional
259
+ * @param types The types to check
260
+ * @returns Whether the type is optional or not
261
+ */
88
262
  export declare const typeIsOptional: (types: TsType[]) => boolean;
263
+ /**
264
+ * Get a typescript or javascript config by path
265
+ * @param path The path to search for a tsconfig.json or jsconfig.json file
266
+ * @returns The config or null if not found
267
+ */
268
+ export declare const getTsJsConfigByPath: (path: string) => {
269
+ compilerOptions?: import("get-tsconfig").TsConfigJson.CompilerOptions | undefined;
270
+ watchOptions?: import("get-tsconfig").TsConfigJson.WatchOptions | undefined;
271
+ typeAcquisition?: import("get-tsconfig").TsConfigJson.TypeAcquisition | undefined;
272
+ compileOnSave?: boolean | undefined;
273
+ files?: string[] | undefined;
274
+ exclude?: string[] | undefined;
275
+ include?: string[] | undefined;
276
+ references?: import("get-tsconfig").TsConfigJson.References[] | undefined;
277
+ } | null;
89
278
  /**
90
279
  * Given an directory path search for a tsconfig.json or jsconfig.json file in it or any of its parent directories, then read the file and parse it as json.
91
280
  *
package/lib/utils.js CHANGED
@@ -8,12 +8,109 @@ import { inspect } from 'util';
8
8
  import { Logger } from './logger.js';
9
9
  import { COMMENT_REG_EXP, PARAM_REG_EXP, OPT_PARAM_REG_EXP } from './constants.js';
10
10
  export { inspect };
11
+ /**
12
+ * Performs a deep comparison between two values to determine if they are
13
+ * equivalent.
14
+ *
15
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
16
+ * date objects, error objects, maps, numbers, `Object` objects, regexes,
17
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
18
+ * by their own, not inherited, enumerable properties. Functions and DOM
19
+ * nodes are **not** supported.
20
+ *
21
+ * @category Lang
22
+ * @param value The value to compare.
23
+ * @param other The other value to compare.
24
+ * @returns Returns `true` if the values are equivalent, else `false`.
25
+ * @example
26
+ *
27
+ * var object = { 'user': 'fred' };
28
+ * var other = { 'user': 'fred' };
29
+ *
30
+ * _.isEqual(object, other);
31
+ * // => true
32
+ *
33
+ * object === other;
34
+ * // => false
35
+ */
11
36
  export const isEqual = lodash.isEqual;
37
+ /**
38
+ * Creates an array of values by running each element in collection through iteratee. The iteratee is
39
+ * invoked with three arguments: (value, index|key, collection).
40
+ *
41
+ * Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues,
42
+ * _.reject, and _.some.
43
+ *
44
+ * The guarded methods are:
45
+ * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max,
46
+ * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range,
47
+ * sample, some, sum, uniq, and words
48
+ *
49
+ * @param collection The collection to iterate over.
50
+ * @param iteratee The function invoked per iteration.
51
+ * @return Returns the new mapped array.
52
+ */
12
53
  export const map = lodash.map;
54
+ /**
55
+ * Iterates over elements of collection, returning the first element predicate returns truthy for.
56
+ * The predicate is invoked with three arguments: (value, index|key, collection).
57
+ *
58
+ * @param collection The collection to search.
59
+ * @param predicate The function invoked per iteration.
60
+ * @param fromIndex The index to search from.
61
+ * @return Returns the matched element, else undefined.
62
+ */
13
63
  export const find = lodash.find;
64
+ /**
65
+ * Recursively merges own and inherited enumerable properties of source
66
+ * objects into the destination object, skipping source properties that resolve
67
+ * to `undefined`. Array and plain object properties are merged recursively.
68
+ * Other objects and value types are overridden by assignment. Source objects
69
+ * are applied from left to right. Subsequent sources overwrite property
70
+ * assignments of previous sources.
71
+ *
72
+ * **Note:** This method mutates `object`.
73
+ *
74
+ * @category Object
75
+ * @param object The destination object.
76
+ * @param [sources] The source objects.
77
+ * @returns Returns `object`.
78
+ * @example
79
+ *
80
+ * var users = {
81
+ * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
82
+ * };
83
+ *
84
+ * var ages = {
85
+ * 'data': [{ 'age': 36 }, { 'age': 40 }]
86
+ * };
87
+ *
88
+ * _.merge(users, ages);
89
+ * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
90
+ */
14
91
  export const merge = lodash.merge;
92
+ /**
93
+ * Creates a shallow clone of value.
94
+ *
95
+ * Note: This method is loosely based on the structured clone algorithm and supports cloning arrays,
96
+ * array buffers, booleans, date objects, maps, numbers, Object objects, regex's, sets, strings, symbols,
97
+ * and typed arrays. The own enumerable properties of arguments objects are cloned as plain objects. An empty
98
+ * object is returned for not cloneable values such as error objects, functions, DOM nodes, and WeakMaps.
99
+ *
100
+ * @param value The value to clone.
101
+ * @return Returns the cloned value.
102
+ */
15
103
  export const clone = lodash.clone;
104
+ /**
105
+ * This method is like clone except that it recursively clones value.
106
+ *
107
+ * @param value The value to recursively clone.
108
+ * @return Returns the deep cloned value.
109
+ */
16
110
  export const cloneDeep = lodash.cloneDeep;
111
+ /**
112
+ * Split a package name into namespace and version
113
+ */
17
114
  export const splitModuleName = (packageName) => {
18
115
  // There are modules that use multiple hyphens like 'GUPnP-DLNA-1.0'
19
116
  const splits = packageName.split('-');
@@ -34,6 +131,9 @@ export const removeNamespace = (type, namespace) => {
34
131
  };
35
132
  /** Remove class module name prefix */
36
133
  export const removeClassModule = removeNamespace;
134
+ /**
135
+ * Add namespace prefix
136
+ */
37
137
  export const addNamespace = (type, namespace) => {
38
138
  if (!type.startsWith(namespace + '.')) {
39
139
  type = namespace + '.' + type;
@@ -42,25 +142,51 @@ export const addNamespace = (type, namespace) => {
42
142
  };
43
143
  /**
44
144
  * Checking whether some variable is iterable
45
- * see https://stackoverflow.com/a/32538867
145
+ * @see https://stackoverflow.com/a/32538867
46
146
  * @param obj Variable to check for iterable
147
+ * @returns Whether the variable is iterable or not
47
148
  */
48
149
  export const isIterable = (obj) => {
49
150
  return obj != null && typeof obj[Symbol.iterator] === 'function';
50
151
  };
152
+ /**
153
+ * Checking whether a string is numeric
154
+ * @param str The string to check
155
+ * @returns Whether the string is numeric or not
156
+ */
51
157
  export const isNumeric = (str) => {
52
158
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
159
  return !isNaN(str - parseFloat(str));
54
160
  };
161
+ /**
162
+ * Get the first character of a string
163
+ * @param str The string to get the first character from
164
+ * @returns The first character
165
+ */
55
166
  export const getFirstChar = (str) => {
56
167
  return str.charAt(0);
57
168
  };
169
+ /**
170
+ * Get the last character of a string
171
+ * @param str The string to get the last character from
172
+ * @returns The last character
173
+ */
58
174
  export const getLastChar = (str) => {
59
175
  return str.charAt(str.length - 1);
60
176
  };
177
+ /**
178
+ * Check if the first character of a string is numeric
179
+ * @param str The string to check
180
+ * @returns Whether the first character is numeric or not
181
+ */
61
182
  export const isFirstCharNumeric = (str) => {
62
183
  return isNumeric(getFirstChar(str));
63
184
  };
185
+ /**
186
+ * Convert a string to camelCase
187
+ * @param str The string to convert
188
+ * @returns The converted string
189
+ */
64
190
  export const camelCase = (str) => {
65
191
  return str
66
192
  .replace(/\s(.)|(\s|-|_|\.)(.)/g, (a) => {
@@ -68,32 +194,47 @@ export const camelCase = (str) => {
68
194
  })
69
195
  .replace(/(\s|-|_|\.)/g, '');
70
196
  };
197
+ /**
198
+ * Convert a string to lowerCamelCase
199
+ * @param str The string to convert
200
+ * @returns The converted string
201
+ */
71
202
  export const lowerCamelCase = (str) => {
72
203
  str = camelCase(str);
73
204
  str = getFirstChar(str).toLowerCase() + str.slice(1);
74
205
  return str;
75
206
  };
207
+ /**
208
+ * Convert a string to UpperCamelCase
209
+ * @param str The string to convert
210
+ * @returns The converted string
211
+ */
76
212
  export const upperCamelCase = (str) => {
77
213
  str = camelCase(str);
78
214
  str = getFirstChar(str).toUpperCase() + str.slice(1);
79
215
  return str;
80
216
  };
217
+ /**
218
+ * Find a file in a list of directories
219
+ * @param dirs The directories to search in
220
+ * @param filename The filename to search for
221
+ * @returns The file info
222
+ */
81
223
  export const findFileInDirs = (dirs, filename) => {
82
- let exists = false;
224
+ const FileInfo = {
225
+ path: null,
226
+ filename,
227
+ exists: false,
228
+ };
83
229
  for (const dir of dirs) {
84
230
  const filePath = Path.join(dir, filename);
85
- exists = fs.existsSync(filePath);
86
- if (exists) {
87
- return {
88
- path: filePath,
89
- exists,
90
- };
231
+ FileInfo.exists = fs.existsSync(filePath);
232
+ if (FileInfo.exists) {
233
+ FileInfo.path = filePath;
234
+ return FileInfo;
91
235
  }
92
236
  }
93
- return {
94
- path: null,
95
- exists,
96
- };
237
+ return FileInfo;
97
238
  };
98
239
  /**
99
240
  * Union (a ∪ b): create a set that contains the elements of both set a and set b.
@@ -117,16 +258,34 @@ export const stripParamNames = (func, ignoreTail = false) => {
117
258
  params = params.replace(OPT_PARAM_REG_EXP, '?:');
118
259
  return `${lb[0]}(${params})${tail}`;
119
260
  };
261
+ /**
262
+ * Check if a line is a comment line
263
+ * @param line The line to check
264
+ * @returns Whether the line is a comment line or not
265
+ */
120
266
  export const isCommentLine = (line) => {
121
267
  const lineTrim = line.trim();
122
268
  return lineTrim.startsWith('//') || (lineTrim.startsWith('/*') && lineTrim.endsWith('*/'));
123
269
  };
270
+ /**
271
+ * Add indents to a string
272
+ * @param indents The number of indents
273
+ * @param spaceForIndent The number of spaces for each indent
274
+ * @returns The indented string
275
+ */
124
276
  export const generateIndent = (indents = 1, spaceForIndent = 4) => {
125
277
  return ' '.repeat(indents * spaceForIndent);
126
278
  };
127
- // Get __dirname on ESM
279
+ // Get __filename on ESM
128
280
  export const __filename = fileURLToPath(import.meta.url);
281
+ // Get __dirname on ESM
129
282
  export const __dirname = Path.dirname(__filename);
283
+ /**
284
+ * Get the output or input directory of the environment
285
+ * @param environment The environment to get the directory for
286
+ * @param baseDir The base directory
287
+ * @returns The path to the directory
288
+ */
130
289
  export const getEnvironmentDir = (environment, baseDir) => {
131
290
  if (!baseDir.endsWith(environment))
132
291
  if (environment === 'gjs' && !baseDir.endsWith('/Gjs')) {
@@ -137,11 +296,24 @@ export const getEnvironmentDir = (environment, baseDir) => {
137
296
  }
138
297
  return baseDir;
139
298
  };
140
- export const getDestPath = (environment, outputDir, outputFilename) => {
299
+ /**
300
+ * Get the destination path for the environment
301
+ * @param environment The environment to get the destination path for
302
+ * @param outputDir The output directory
303
+ * @param parts The path parts
304
+ * @returns The destination path
305
+ */
306
+ export const getDestPath = (environment, outputDir, ...parts) => {
141
307
  const outputEnvDir = getEnvironmentDir(environment, outputDir);
142
- const destPath = Path.join(outputEnvDir, outputFilename);
308
+ const destPath = Path.join(outputEnvDir, ...parts);
143
309
  return destPath;
144
310
  };
311
+ /**
312
+ * Convert a GirBoolean to a boolean
313
+ * @param boolStr The GirBoolean string
314
+ * @param defaultVal The default value
315
+ * @returns The boolean value
316
+ */
145
317
  export const girBool = (boolStr, defaultVal = false) => {
146
318
  if (boolStr) {
147
319
  if (parseInt(boolStr) === 0)
@@ -180,6 +352,11 @@ export const girElementIsIntrospectable = (girElement, name) => {
180
352
  // ...otherwise we assume that it is introspectable
181
353
  return true;
182
354
  };
355
+ /**
356
+ * Check if a type is optional
357
+ * @param types The types to check
358
+ * @returns Whether the type is optional or not
359
+ */
183
360
  export const typeIsOptional = (types) => {
184
361
  for (const type of types) {
185
362
  if (type.optional)
@@ -187,7 +364,12 @@ export const typeIsOptional = (types) => {
187
364
  }
188
365
  return false;
189
366
  };
190
- function convertTsJsConfigToObject(path) {
367
+ /**
368
+ * Get a typescript or javascript config by path
369
+ * @param path The path to search for a tsconfig.json or jsconfig.json file
370
+ * @returns The config or null if not found
371
+ */
372
+ export const getTsJsConfigByPath = (path) => {
191
373
  try {
192
374
  const config = getTsconfig(path)?.config;
193
375
  if (config)
@@ -197,7 +379,7 @@ function convertTsJsConfigToObject(path) {
197
379
  // ignored
198
380
  }
199
381
  return null;
200
- }
382
+ };
201
383
  /**
202
384
  * Given an directory path search for a tsconfig.json or jsconfig.json file in it or any of its parent directories, then read the file and parse it as json.
203
385
  *
@@ -211,8 +393,8 @@ export function readTsJsConfig(path) {
211
393
  const tsConfigPath = Path.join(currentPath, 'tsconfig.json');
212
394
  const jsConfigPath = Path.join(currentPath, 'jsconfig.json');
213
395
  config =
214
- (fs.existsSync(tsConfigPath) && convertTsJsConfigToObject(tsConfigPath)) ||
215
- (fs.existsSync(jsConfigPath) && convertTsJsConfigToObject(jsConfigPath));
396
+ (fs.existsSync(tsConfigPath) && getTsJsConfigByPath(tsConfigPath)) ||
397
+ (fs.existsSync(jsConfigPath) && getTsJsConfigByPath(jsConfigPath));
216
398
  lastPath = currentPath;
217
399
  currentPath = Path.dirname(currentPath);
218
400
  }
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,WAAW,EAAwB,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElF,OAAO,EAAE,OAAO,EAAE,CAAA;AAElB,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;AAErC,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;AAE7B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;AAE/B,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;AAEjC,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;AAEjC,MAAM,CAAC,MAAM,SAAS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