@ts-for-gir/cli 4.0.0-beta.24 → 4.0.0-beta.26

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 (62) hide show
  1. package/README.md +84 -2
  2. package/bin/ts-for-gir.js +43 -0
  3. package/package.json +30 -36
  4. package/src/commands/analyze.ts +344 -0
  5. package/src/commands/command-builder.ts +30 -0
  6. package/src/commands/copy.ts +71 -76
  7. package/src/commands/doc.ts +58 -46
  8. package/src/commands/generate.ts +97 -77
  9. package/src/commands/index.ts +6 -4
  10. package/src/commands/json.ts +104 -0
  11. package/src/commands/list.ts +81 -90
  12. package/src/config/config-loader.ts +203 -0
  13. package/src/config/config-writer.ts +52 -0
  14. package/src/config/defaults.ts +61 -0
  15. package/src/config/index.ts +8 -0
  16. package/src/config/options.ts +292 -0
  17. package/src/config.ts +3 -456
  18. package/src/formatters/typescript-formatter.ts +24 -0
  19. package/src/generation-handler.ts +122 -67
  20. package/src/index.ts +4 -4
  21. package/src/module-loader/dependency-resolver.ts +100 -0
  22. package/src/module-loader/file-finder.ts +56 -0
  23. package/src/module-loader/index.ts +8 -0
  24. package/src/module-loader/module-grouper.ts +77 -0
  25. package/src/module-loader/prompt-handler.ts +111 -0
  26. package/src/module-loader.ts +280 -580
  27. package/src/start.ts +18 -14
  28. package/src/types/command-args.ts +110 -0
  29. package/src/types/command-definition.ts +15 -0
  30. package/src/types/commands.ts +35 -0
  31. package/src/types/index.ts +15 -0
  32. package/src/types/report-types.ts +34 -0
  33. package/lib/commands/copy.d.ts +0 -12
  34. package/lib/commands/copy.js +0 -78
  35. package/lib/commands/copy.js.map +0 -1
  36. package/lib/commands/doc.d.ts +0 -12
  37. package/lib/commands/doc.js +0 -38
  38. package/lib/commands/doc.js.map +0 -1
  39. package/lib/commands/generate.d.ts +0 -12
  40. package/lib/commands/generate.js +0 -70
  41. package/lib/commands/generate.js.map +0 -1
  42. package/lib/commands/index.d.ts +0 -4
  43. package/lib/commands/index.js +0 -5
  44. package/lib/commands/index.js.map +0 -1
  45. package/lib/commands/list.d.ts +0 -12
  46. package/lib/commands/list.js +0 -79
  47. package/lib/commands/list.js.map +0 -1
  48. package/lib/config.d.ts +0 -108
  49. package/lib/config.js +0 -409
  50. package/lib/config.js.map +0 -1
  51. package/lib/generation-handler.d.ts +0 -10
  52. package/lib/generation-handler.js +0 -48
  53. package/lib/generation-handler.js.map +0 -1
  54. package/lib/index.d.ts +0 -4
  55. package/lib/index.js +0 -5
  56. package/lib/index.js.map +0 -1
  57. package/lib/module-loader.d.ts +0 -154
  58. package/lib/module-loader.js +0 -465
  59. package/lib/module-loader.js.map +0 -1
  60. package/lib/start.d.ts +0 -2
  61. package/lib/start.js +0 -16
  62. package/lib/start.js.map +0 -1
@@ -1,154 +0,0 @@
1
- /**
2
- * The ModuleLoader is used for reading gir modules from the file system and to solve conflicts (e.g. Gtk-3.0 and Gtk-4.0 would be a conflict)
3
- */
4
- import { type Question } from 'inquirer';
5
- import { DependencyManager, ResolveType, GirModule, Logger } from '@ts-for-gir/lib';
6
- import type { GirModulesGroupedMap, OptionsGeneration, GirModuleResolvedBy, GirModulesGrouped, DependencyMap, Dependency, AnswerVersion } from '@ts-for-gir/lib';
7
- export declare class ModuleLoader {
8
- protected readonly config: OptionsGeneration;
9
- log: Logger;
10
- dependencyManager: DependencyManager;
11
- /** Transitive module dependencies */
12
- modDependencyMap: DependencyMap;
13
- constructor(config: OptionsGeneration);
14
- /**
15
- * Groups Gir modules by name id
16
- * E.g. Gtk-3.0 and Gtk-4.0 will be grouped
17
- * @param girFiles
18
- */
19
- protected groupGirFiles(resolveGirModules: Set<GirModuleResolvedBy> | GirModuleResolvedBy[]): GirModulesGroupedMap;
20
- /**
21
- * Sorts out the module the user has not selected via cli prompt
22
- * @param girModulesGrouped
23
- * @param selected Users selected module packageName
24
- */
25
- protected sortVersionsByAnswer(girModulesGrouped: GirModulesGrouped, selected: string[]): {
26
- keep: Set<GirModuleResolvedBy>;
27
- ignore: string[];
28
- };
29
- protected generateContinueQuestion(message?: string, choices?: string[]): {
30
- message: string;
31
- choices: string[];
32
- };
33
- protected generateIgnoreDepsQuestion(message?: string, choices?: string[]): {
34
- message: string;
35
- choices: string[];
36
- };
37
- protected askIgnoreDepsPrompt(deps: GirModuleResolvedBy[] | Set<GirModuleResolvedBy>): Promise<'Yes' | 'No' | 'Go back'>;
38
- /**
39
- * Ask for duplicates / multiple versions of a module
40
- * @param girModuleGrouped
41
- * @param message
42
- */
43
- protected generateModuleVersionQuestion(girModuleGrouped: GirModulesGrouped, message?: string): Question;
44
- /**
45
- * Find modules that depend on the module with the name 'packageName'
46
- * @param girModulesGroupedMap
47
- * @param packageName
48
- */
49
- protected findGirFilesDependOnPackage(girModulesGroupedMap: GirModulesGroupedMap, packageName: string): GirModuleResolvedBy[];
50
- /**
51
- * Find modules that depend on the module with the names in `packageNames`
52
- * @param girModulesGroupedMap
53
- * @param packageName
54
- */
55
- protected findGirFilesDependOnPackages(girModulesGroupedMap: GirModulesGroupedMap, packageNames: string[]): GirModuleResolvedBy[];
56
- protected askForVersionsPrompt(girModulesGrouped: GirModulesGrouped): Promise<AnswerVersion>;
57
- /**
58
- * If multiple versions of the same module are found, this will aks the user with input prompts for the version he wish to use.
59
- * Ignores also modules that depend on a module that should be ignored
60
- * @param resolveFirModules
61
- */
62
- protected askForEachConflictVersionsPrompt(girModulesGroupedMap: GirModulesGroupedMap, ignore: string[]): Promise<{
63
- keep: Set<GirModuleResolvedBy>;
64
- ignore: string[];
65
- }>;
66
- /**
67
- * Asks via cli prompt if the user wants to add the ignored modules to his config file
68
- * @param ignoredModules
69
- */
70
- protected askAddToIgnoreToConfigPrompt(ignoredModules: string[] | Set<string>): Promise<void>;
71
- /**
72
- * Figure out transitive module dependencies
73
- * @param packageName
74
- * @param result
75
- */
76
- protected traverseDependencies(packageName: string, result?: {
77
- [name: string]: Dependency;
78
- }): void;
79
- /**
80
- * Extends the modDependencyMap by the current Module,
81
- * should be called for each girModule so that the modDependencyMap is complete
82
- * @param girModule
83
- */
84
- protected extendDependencyMapByGirModule(girModule: GirModule): void;
85
- /**
86
- * Sets the traverse dependencies for the current girModule,
87
- * is required so that all dependencies can be found internally when generating the dependency imports for the module .d.ts file
88
- * @param girModules
89
- */
90
- protected initGirModules(girModules: GirModuleResolvedBy[]): Promise<void>;
91
- /**
92
- * Reads a gir xml module file and creates an object of GirModule.
93
- * Also sets the setDependencyMap
94
- * @param fillName
95
- * @param config
96
- */
97
- protected loadAndCreateGirModule(dependency: Dependency): Promise<GirModule | null>;
98
- /**
99
- * Returns a girModule found by `packageName` property
100
- * @param girModules Array of girModules
101
- * @param packageNames Full name like 'Gtk-3.0' you are looking for
102
- */
103
- protected findGirModuleByFullNames(girModules: (GirModuleResolvedBy | GirModule)[], packageNames: string[]): Array<GirModuleResolvedBy | GirModule>;
104
- /**
105
- * Checks if a girModules with the `packageNames` exists
106
- * @param girModules
107
- * @param packageName
108
- */
109
- protected existsGirModules(girModules: (GirModuleResolvedBy | GirModule)[], packageName: string): boolean;
110
- /**
111
- * Reads the gir xml module files and creates an object of GirModule for each module
112
- * @param dependencies
113
- * @param girModules
114
- * @param resolvedBy
115
- * @param failedGirModules
116
- * @param ignoreDependencies
117
- * @returns
118
- */
119
- protected loadGirModules(dependencies: Dependency[], ignoreDependencies?: string[], girModules?: GirModuleResolvedBy[], resolvedBy?: ResolveType, failedGirModules?: Set<string>): Promise<{
120
- loaded: GirModuleResolvedBy[];
121
- failed: Set<string>;
122
- }>;
123
- /**
124
- * Find modules with the possibility to use wild cards for module names. E.g. `Gtk*` or `'*'`
125
- * @param modules
126
- * @param ignore
127
- */
128
- protected findGirFiles(globPackageNames: string[], ignore?: string[]): Promise<Set<string>>;
129
- protected girFilePathToDependencies(girFiles: Set<string>): Promise<Dependency[]>;
130
- /**
131
- * Loads all found `packageNames`
132
- * @param girDirectories
133
- * @param packageNames
134
- * @param doNotAskForVersionOnConflict Set this to false if you want to get a prompt for each version conflict
135
- */
136
- getModulesResolved(packageNames: string[], ignore?: string[], doNotAskForVersionOnConflict?: boolean): Promise<{
137
- keep: GirModuleResolvedBy[];
138
- grouped: GirModulesGroupedMap;
139
- ignore: string[];
140
- failed: Set<string>;
141
- }>;
142
- /**
143
- * Find modules
144
- * @param girDirectories
145
- * @param modules
146
- */
147
- getModules(modules: string[], ignore?: string[]): Promise<{
148
- grouped: GirModulesGroupedMap;
149
- loaded: GirModuleResolvedBy[];
150
- failed: string[];
151
- }>;
152
- /** Start parsing the gir modules */
153
- parse(girModules: GirModuleResolvedBy[]): void;
154
- }
@@ -1,465 +0,0 @@
1
- /**
2
- * The ModuleLoader is used for reading gir modules from the file system and to solve conflicts (e.g. Gtk-3.0 and Gtk-4.0 would be a conflict)
3
- */
4
- import { select } from '@inquirer/prompts';
5
- import { glob } from 'glob';
6
- import { basename, join } from 'path';
7
- import { bold } from 'colorette';
8
- import { DependencyManager, ResolveType, GirModule, Logger, splitModuleName, union, isIterable, WARN_NO_GIR_FILE_FOUND_FOR_PACKAGE, } from '@ts-for-gir/lib';
9
- import { Config } from './config.js';
10
- export class ModuleLoader {
11
- config;
12
- log;
13
- dependencyManager;
14
- /** Transitive module dependencies */
15
- modDependencyMap = {};
16
- constructor(config) {
17
- this.config = config;
18
- this.log = new Logger(config.verbose, 'ModuleLoader');
19
- this.dependencyManager = DependencyManager.getInstance(config);
20
- }
21
- /**
22
- * Groups Gir modules by name id
23
- * E.g. Gtk-3.0 and Gtk-4.0 will be grouped
24
- * @param girFiles
25
- */
26
- groupGirFiles(resolveGirModules) {
27
- const girModulesGrouped = {};
28
- for (const resolveGirModule of resolveGirModules) {
29
- const { namespace } = splitModuleName(resolveGirModule.packageName);
30
- const id = namespace.toLowerCase();
31
- if (!girModulesGrouped[id]) {
32
- girModulesGrouped[id] = {
33
- namespace: namespace,
34
- modules: [resolveGirModule],
35
- hasConflict: false,
36
- };
37
- }
38
- else {
39
- girModulesGrouped[id].modules.push(resolveGirModule);
40
- girModulesGrouped[id].hasConflict = true;
41
- }
42
- }
43
- return girModulesGrouped;
44
- }
45
- /**
46
- * Sorts out the module the user has not selected via cli prompt
47
- * @param girModulesGrouped
48
- * @param selected Users selected module packageName
49
- */
50
- sortVersionsByAnswer(girModulesGrouped, selected) {
51
- const keep = new Set();
52
- let ignore = [];
53
- if (!girModulesGrouped.hasConflict) {
54
- keep.add(girModulesGrouped.modules[0]);
55
- }
56
- else {
57
- const keepModules = this.findGirModuleByFullNames(girModulesGrouped.modules, selected);
58
- const girModulePackageNames = girModulesGrouped.modules.map((resolveGirModule) => resolveGirModule.packageName);
59
- if (!keepModules || keepModules.length <= 0) {
60
- throw new Error('Module not found!');
61
- }
62
- for (const keepModule of keepModules) {
63
- keep.add(keepModule);
64
- }
65
- const toIgnore = girModulePackageNames.filter((packageName) => !selected.includes(packageName));
66
- ignore = ignore.concat(toIgnore);
67
- }
68
- return {
69
- keep,
70
- ignore,
71
- };
72
- }
73
- generateContinueQuestion(message = `do you want to continue?`, choices = ['Yes', 'Go back']) {
74
- return {
75
- message,
76
- choices,
77
- };
78
- }
79
- generateIgnoreDepsQuestion(message = `Do you want to ignore them too?`, choices = ['Yes', 'No', 'Go back']) {
80
- return {
81
- message,
82
- choices,
83
- };
84
- }
85
- async askIgnoreDepsPrompt(deps) {
86
- const size = deps.length || deps.size || 0;
87
- if (size > 0) {
88
- // Show dependencies that would be ignored
89
- this.log.log(bold('\nThe following modules have the ignored modules as dependencies:'));
90
- for (const dep of deps) {
91
- this.log.log(`- ${dep.packageName}`);
92
- }
93
- this.log.log(bold('\n'));
94
- // Ask if user wants to ignore these dependencies
95
- return select({
96
- message: 'Do you want to ignore them too?',
97
- choices: [
98
- { value: 'Yes', name: 'Yes' },
99
- { value: 'No', name: 'No' },
100
- { value: 'Go back', name: 'Go back' },
101
- ],
102
- });
103
- }
104
- // No dependencies found
105
- this.log.log(bold('\nNo dependencies found on the ignored modules'));
106
- return select({
107
- message: 'Do you want to continue?',
108
- choices: [
109
- { value: 'Yes', name: 'Yes' },
110
- { value: 'Go back', name: 'Go back' },
111
- ],
112
- });
113
- }
114
- /**
115
- * Ask for duplicates / multiple versions of a module
116
- * @param girModuleGrouped
117
- * @param message
118
- */
119
- generateModuleVersionQuestion(girModuleGrouped, message) {
120
- message = message || `Multiple versions of '${girModuleGrouped.namespace}' found, which one do you want to use?`;
121
- const choices = ['All', ...girModuleGrouped.modules.map((module) => module.packageName)];
122
- return {
123
- name: girModuleGrouped.namespace,
124
- message,
125
- type: 'list',
126
- choices,
127
- };
128
- }
129
- /**
130
- * Find modules that depend on the module with the name 'packageName'
131
- * @param girModulesGroupedMap
132
- * @param packageName
133
- */
134
- findGirFilesDependOnPackage(girModulesGroupedMap, packageName) {
135
- const girModules = [];
136
- for (const girModulesGrouped of Object.values(girModulesGroupedMap)) {
137
- for (const girModuleResolvedBy of girModulesGrouped.modules) {
138
- if (girModuleResolvedBy.packageName === packageName) {
139
- continue;
140
- }
141
- for (const dep of girModuleResolvedBy.module.dependencies) {
142
- if (dep.packageName === packageName && !girModules.includes(girModuleResolvedBy)) {
143
- girModules.push(girModuleResolvedBy);
144
- }
145
- }
146
- }
147
- }
148
- return girModules;
149
- }
150
- /**
151
- * Find modules that depend on the module with the names in `packageNames`
152
- * @param girModulesGroupedMap
153
- * @param packageName
154
- */
155
- findGirFilesDependOnPackages(girModulesGroupedMap, packageNames) {
156
- let girModules = [];
157
- for (const packageName of packageNames) {
158
- girModules = [...girModules, ...this.findGirFilesDependOnPackage(girModulesGroupedMap, packageName)];
159
- }
160
- return girModules;
161
- }
162
- async askForVersionsPrompt(girModulesGrouped) {
163
- const choices = ['All', ...girModulesGrouped.modules.map((module) => module.packageName)];
164
- const selected = await select({
165
- message: `Multiple versions of '${girModulesGrouped.namespace}' found, which one do you want to use?`,
166
- choices: choices.map((choice) => ({
167
- value: choice,
168
- name: choice,
169
- })),
170
- });
171
- if (selected === 'All') {
172
- return {
173
- selected: choices.filter((choice) => choice !== 'All'),
174
- unselected: [],
175
- };
176
- }
177
- return {
178
- selected: [selected],
179
- unselected: choices.filter((choice) => choice !== selected && choice !== 'All'),
180
- };
181
- }
182
- /**
183
- * If multiple versions of the same module are found, this will aks the user with input prompts for the version he wish to use.
184
- * Ignores also modules that depend on a module that should be ignored
185
- * @param resolveFirModules
186
- */
187
- async askForEachConflictVersionsPrompt(girModulesGroupedMap, ignore) {
188
- let keep = new Set();
189
- for (const girModulesGrouped of Object.values(girModulesGroupedMap)) {
190
- // Remove ignored modules from group
191
- girModulesGrouped.modules = girModulesGrouped.modules.filter((girGroup) => !ignore.includes(girGroup.packageName));
192
- girModulesGrouped.hasConflict = girModulesGrouped.modules.length >= 2;
193
- if (girModulesGrouped.modules.length <= 0) {
194
- continue;
195
- }
196
- // Ask for version if there is a conflict
197
- if (!girModulesGrouped.hasConflict) {
198
- keep = union(keep, girModulesGrouped.modules);
199
- }
200
- else {
201
- let goBack = true;
202
- let versionAnswer = null;
203
- let ignoreDepsAnswer = null;
204
- let wouldIgnoreDeps = [];
205
- while (goBack) {
206
- versionAnswer = await this.askForVersionsPrompt(girModulesGrouped);
207
- // Check modules that depend on the unchosen modules
208
- wouldIgnoreDeps = this.findGirFilesDependOnPackages(girModulesGroupedMap, versionAnswer.unselected);
209
- // Do not check dependencies that have already been ignored
210
- wouldIgnoreDeps = wouldIgnoreDeps.filter((dep) => !ignore.includes(dep.packageName));
211
- ignoreDepsAnswer = await this.askIgnoreDepsPrompt(wouldIgnoreDeps);
212
- goBack = ignoreDepsAnswer === 'Go back';
213
- }
214
- if (!versionAnswer) {
215
- throw new Error('Error in processing the prompt versionAnswer');
216
- }
217
- if (ignoreDepsAnswer === 'Yes') {
218
- // Also ignore the dependencies of the unselected version
219
- ignore = ignore.concat(wouldIgnoreDeps.map((dep) => dep.packageName));
220
- }
221
- const unionMe = this.sortVersionsByAnswer(girModulesGrouped, versionAnswer.selected);
222
- // Do not ignore the selected package version
223
- keep = union(keep, unionMe.keep);
224
- // Ignore the unchosen package versions
225
- ignore = ignore.concat(unionMe.ignore);
226
- }
227
- }
228
- if (ignore && ignore.length > 0) {
229
- const ignoreLogList = '- ' + ignore.join('\n- ');
230
- this.log.log(bold(`\n The following modules will be ignored:`));
231
- this.log.log(`\n${ignoreLogList}\n`);
232
- await this.askAddToIgnoreToConfigPrompt(ignore);
233
- }
234
- return {
235
- keep,
236
- ignore,
237
- };
238
- }
239
- /**
240
- * Asks via cli prompt if the user wants to add the ignored modules to his config file
241
- * @param ignoredModules
242
- */
243
- async askAddToIgnoreToConfigPrompt(ignoredModules) {
244
- const shouldAdd = await select({
245
- message: `Do you want to add the ignored modules to your config so that you don't need to select them again next time?\n Config path: '${Config.configFilePath}'`,
246
- choices: [
247
- { value: 'No', name: 'No' },
248
- { value: 'Yes', name: 'Yes' },
249
- ],
250
- });
251
- if (shouldAdd === 'Yes') {
252
- await Config.addToConfig({
253
- ignore: Array.from(ignoredModules),
254
- });
255
- this.log.log(`Add ignored modules to '${Config.configFilePath}'`);
256
- }
257
- }
258
- /**
259
- * Figure out transitive module dependencies
260
- * @param packageName
261
- * @param result
262
- */
263
- traverseDependencies(packageName, result = {}) {
264
- const deps = this.modDependencyMap[packageName];
265
- if (isIterable(deps)) {
266
- for (const dep of deps) {
267
- if (result[dep.packageName])
268
- continue;
269
- result[dep.packageName] = dep;
270
- this.traverseDependencies(dep.packageName, result);
271
- }
272
- }
273
- }
274
- /**
275
- * Extends the modDependencyMap by the current Module,
276
- * should be called for each girModule so that the modDependencyMap is complete
277
- * @param girModule
278
- */
279
- extendDependencyMapByGirModule(girModule) {
280
- this.modDependencyMap[girModule.packageName] = girModule.dependencies;
281
- }
282
- /**
283
- * Sets the traverse dependencies for the current girModule,
284
- * is required so that all dependencies can be found internally when generating the dependency imports for the module .d.ts file
285
- * @param girModules
286
- */
287
- async initGirModules(girModules) {
288
- for (const girModule of girModules) {
289
- const result = {};
290
- this.traverseDependencies(girModule.packageName, result);
291
- await girModule.module.initTransitiveDependencies(Object.values(result));
292
- }
293
- }
294
- /**
295
- * Reads a gir xml module file and creates an object of GirModule.
296
- * Also sets the setDependencyMap
297
- * @param fillName
298
- * @param config
299
- */
300
- async loadAndCreateGirModule(dependency) {
301
- if (!dependency.exists || dependency.path === null) {
302
- return null;
303
- }
304
- this.log.log(`Loading ${dependency.packageName}...`);
305
- const girModule = await GirModule.load(dependency, this.config, this.dependencyManager);
306
- // Figure out transitive module dependencies
307
- this.extendDependencyMapByGirModule(girModule);
308
- return girModule;
309
- }
310
- /**
311
- * Returns a girModule found by `packageName` property
312
- * @param girModules Array of girModules
313
- * @param packageNames Full name like 'Gtk-3.0' you are looking for
314
- */
315
- findGirModuleByFullNames(girModules, packageNames) {
316
- return girModules.filter((girModule) => packageNames.includes(girModule.packageName));
317
- }
318
- /**
319
- * Checks if a girModules with the `packageNames` exists
320
- * @param girModules
321
- * @param packageName
322
- */
323
- existsGirModules(girModules, packageName) {
324
- const foundModule = this.findGirModuleByFullNames(girModules, [packageName]);
325
- return foundModule.length > 0;
326
- }
327
- /**
328
- * Reads the gir xml module files and creates an object of GirModule for each module
329
- * @param dependencies
330
- * @param girModules
331
- * @param resolvedBy
332
- * @param failedGirModules
333
- * @param ignoreDependencies
334
- * @returns
335
- */
336
- async loadGirModules(dependencies, ignoreDependencies = [], girModules = [], resolvedBy = ResolveType.BY_HAND, failedGirModules = new Set()) {
337
- let newModuleFound = false;
338
- // Clone array
339
- dependencies = [...dependencies];
340
- while (dependencies.length > 0) {
341
- const dependency = dependencies.shift();
342
- if (!dependency?.packageName)
343
- continue;
344
- // If module has not already been loaded
345
- if (!this.existsGirModules(girModules, dependency.packageName)) {
346
- const girModule = await this.loadAndCreateGirModule(dependency);
347
- if (!girModule) {
348
- if (!failedGirModules.has(dependency.packageName)) {
349
- this.log.warn(WARN_NO_GIR_FILE_FOUND_FOR_PACKAGE(dependency.packageName));
350
- failedGirModules.add(dependency.packageName);
351
- }
352
- }
353
- else if (girModule && girModule.packageName) {
354
- const addModule = {
355
- packageName: girModule.packageName,
356
- module: girModule,
357
- resolvedBy,
358
- path: dependency.path,
359
- };
360
- girModules.push(addModule);
361
- newModuleFound = true;
362
- }
363
- }
364
- }
365
- if (!newModuleFound) {
366
- return {
367
- loaded: girModules,
368
- failed: failedGirModules,
369
- };
370
- }
371
- // Figure out transitive module dependencies
372
- await this.initGirModules(girModules);
373
- // Load girModules for dependencies
374
- for (const girModule of girModules) {
375
- // Load dependencies
376
- const transitiveDependencies = girModule.module.transitiveDependencies;
377
- if (transitiveDependencies.length > 0) {
378
- await this.loadGirModules(transitiveDependencies, ignoreDependencies, girModules, ResolveType.DEPENDENCE, failedGirModules);
379
- }
380
- }
381
- return {
382
- loaded: girModules,
383
- failed: failedGirModules,
384
- };
385
- }
386
- /**
387
- * Find modules with the possibility to use wild cards for module names. E.g. `Gtk*` or `'*'`
388
- * @param modules
389
- * @param ignore
390
- */
391
- async findGirFiles(globPackageNames, ignore = []) {
392
- const foundFiles = new Set();
393
- for (let i = 0; i < globPackageNames.length; i++) {
394
- if (!globPackageNames[i]) {
395
- continue;
396
- }
397
- const filename = `${globPackageNames[i]}.gir`;
398
- const pattern = this.config.girDirectories.map((girDirectory) => join(girDirectory, filename));
399
- const ignoreGirs = ignore.map((girDirectory) => girDirectory + '.gir');
400
- const files = await glob(pattern, { ignore: ignoreGirs });
401
- files.forEach((file) => foundFiles.add(file));
402
- }
403
- return foundFiles;
404
- }
405
- async girFilePathToDependencies(girFiles) {
406
- const dependencies = [];
407
- for (const girFile of girFiles) {
408
- const packageName = basename(girFile, '.gir');
409
- const { namespace, version } = splitModuleName(packageName);
410
- const dep = await this.dependencyManager.get(namespace, version);
411
- dependencies.push(dep);
412
- }
413
- return dependencies;
414
- }
415
- /**
416
- * Loads all found `packageNames`
417
- * @param girDirectories
418
- * @param packageNames
419
- * @param doNotAskForVersionOnConflict Set this to false if you want to get a prompt for each version conflict
420
- */
421
- async getModulesResolved(packageNames, ignore = [], doNotAskForVersionOnConflict = true) {
422
- const girFiles = await this.findGirFiles([...packageNames], ignore);
423
- // Always require these because GJS does...
424
- const GLib = await this.dependencyManager.get('GLib', '2.0');
425
- const Gio = await this.dependencyManager.get('Gio', '2.0');
426
- const GObject = await this.dependencyManager.get('GObject', '2.0');
427
- const dependencies = await this.girFilePathToDependencies(girFiles);
428
- const { loaded, failed } = await this.loadGirModules([
429
- GLib,
430
- Gio,
431
- GObject,
432
- ...dependencies.filter((dep) => dep.namespace !== 'GLib' && dep.namespace !== 'Gio' && dep.namespace !== 'GObject'),
433
- ], ignore);
434
- let keep = [];
435
- if (doNotAskForVersionOnConflict) {
436
- keep = loaded;
437
- }
438
- else {
439
- const girModulesGrouped = this.groupGirFiles(loaded);
440
- const filtered = await this.askForEachConflictVersionsPrompt(girModulesGrouped, ignore);
441
- keep = Array.from(filtered.keep);
442
- }
443
- const grouped = this.groupGirFiles(keep);
444
- return { keep, grouped, ignore, failed };
445
- }
446
- /**
447
- * Find modules
448
- * @param girDirectories
449
- * @param modules
450
- */
451
- async getModules(modules, ignore = []) {
452
- const girFiles = await this.findGirFiles(modules, ignore);
453
- const dependencies = await this.girFilePathToDependencies(girFiles);
454
- const { loaded, failed } = await this.loadGirModules(dependencies, ignore);
455
- const grouped = this.groupGirFiles(loaded);
456
- return { grouped, loaded, failed: Array.from(failed) };
457
- }
458
- /** Start parsing the gir modules */
459
- parse(girModules) {
460
- for (const girModule of girModules) {
461
- girModule.module.parse();
462
- }
463
- }
464
- }
465
- //# sourceMappingURL=module-loader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-loader.js","sourceRoot":"","sources":["../src/module-loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,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CAAC;IACL,CAAC;CACJ"}
package/lib/start.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/lib/start.js DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- import yargs from 'yargs';
3
- import { hideBin } from 'yargs/helpers';
4
- import { generate, list, doc, copy } from './commands/index.js';
5
- import { Config } from './config.js';
6
- void yargs(hideBin(process.argv))
7
- .scriptName(Config.appName)
8
- .strict()
9
- .usage(Config.usage)
10
- .command(generate.command, generate.description, generate.builder, generate.handler)
11
- .command(list.command, list.description, list.builder, list.handler)
12
- .command(copy.command, copy.description, copy.builder, copy.handler)
13
- .command(doc.command, doc.description, doc.builder, doc.handler)
14
- .demandCommand(1)
15
- .help().argv;
16
- //# sourceMappingURL=start.js.map
package/lib/start.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,KAAK,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KAC5B,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC;KAC1B,MAAM,EAAE;KACR,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;KACnB,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC;KACnF,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC;KACnE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC;KACnE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC;KAC/D,aAAa,CAAC,CAAC,CAAC;KAChB,IAAI,EAAE,CAAC,IAAI,CAAA"}