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

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 (53) hide show
  1. package/README.md +15 -6
  2. package/lib/config.js +40 -48
  3. package/lib/config.js.map +1 -1
  4. package/lib/template-processor.js +1 -1
  5. package/lib/template-processor.js.map +1 -1
  6. package/lib/type-definition-generator.d.ts +0 -1
  7. package/lib/type-definition-generator.js +8 -13
  8. package/lib/type-definition-generator.js.map +1 -1
  9. package/lib/types/build-type.d.ts +1 -1
  10. package/lib/types/construct-name.d.ts +1 -1
  11. package/lib/types/environment.d.ts +1 -1
  12. package/lib/types/gir-any-element.d.ts +1 -1
  13. package/lib/types/gir-boolean.d.ts +1 -1
  14. package/lib/types/gir-unparsed-number.d.ts +1 -1
  15. package/lib/types/injection-generic-parameter.d.ts +1 -1
  16. package/lib/types/injection-instance-parameter.d.ts +1 -1
  17. package/lib/types/injection-type.d.ts +1 -1
  18. package/lib/types/local-name-type.d.ts +1 -1
  19. package/lib/types/module-type.d.ts +1 -1
  20. package/lib/types/transformation-case.d.ts +1 -1
  21. package/lib/types/ts-method.d.ts +1 -1
  22. package/lib/types/ts-type-name.d.ts +1 -1
  23. package/lib/types/ts-type-separator.d.ts +1 -1
  24. package/lib/types/type-gir-alias.d.ts +1 -1
  25. package/lib/types/type-gir-class.d.ts +1 -1
  26. package/lib/types/type-gir-element.d.ts +1 -1
  27. package/lib/types/type-gir-enumeration-member.d.ts +1 -1
  28. package/lib/types/type-gir-enumeration.d.ts +1 -1
  29. package/lib/types/type-gir-function.d.ts +1 -1
  30. package/lib/types/type-gir-interface.d.ts +1 -1
  31. package/lib/types/type-gir-method.d.ts +1 -1
  32. package/lib/types/type-gir-parameter.d.ts +1 -1
  33. package/lib/types/type-gir-property.d.ts +1 -1
  34. package/lib/types/type-gir-variable.d.ts +1 -1
  35. package/lib/types/type-ts-element.d.ts +1 -1
  36. package/lib/types/type-ts-enumeration-member.d.ts +1 -1
  37. package/lib/types/type-ts-function.d.ts +1 -1
  38. package/lib/types/type-ts-property.d.ts +1 -1
  39. package/lib/utils.d.ts +10 -3
  40. package/lib/utils.js +4 -6
  41. package/lib/utils.js.map +1 -1
  42. package/package.json +20 -19
  43. package/src/config.ts +42 -59
  44. package/src/template-processor.ts +1 -1
  45. package/src/type-definition-generator.ts +8 -14
  46. package/src/utils.ts +5 -10
  47. package/templates/Gjs/Gjs.d.ts +3 -1
  48. package/templates/Gjs/GnomeShell.d.ts +118 -0
  49. package/templates/Gjs/GnomeShell.js +10 -0
  50. package/templates/Gjs/index.d.ts +3 -0
  51. package/templates/Gjs/misc/extensionUtils.d.ts +99 -0
  52. package/templates/Gjs/misc/extensionUtils.js +6 -0
  53. package/templates/Gjs/cast.ts +0 -52
@@ -2,4 +2,4 @@ import { TsFunction } from './index.js';
2
2
  /**
3
3
  * Holds the data to generate a method in/for Typescript
4
4
  */
5
- export declare type TsMethod = TsFunction;
5
+ export type TsMethod = TsFunction;
@@ -1 +1 @@
1
- export declare type TsTypeName = 'function' | 'method' | 'static-function' | 'interface' | 'event-methods' | 'constructor';
1
+ export type TsTypeName = 'function' | 'method' | 'static-function' | 'interface' | 'event-methods' | 'constructor';
@@ -1 +1 @@
1
- export declare type TsTypeSeparator = '&' | '|';
1
+ export type TsTypeSeparator = '&' | '|';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript `type` */
2
- export declare type TypeGirAlias = 'alias';
2
+ export type TypeGirAlias = 'alias';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript class */
2
- export declare type TypeGirClass = 'class' | 'record' | 'interface' | 'union';
2
+ export type TypeGirClass = 'class' | 'record' | 'interface' | 'union';
@@ -1,3 +1,3 @@
1
1
  import { TypeGirClass, TypeGirMethod, TypeGirVariable, TypeGirAlias, TypeGirEnumeration, TypeGirEnumerationMember, TypeGirInterface, TypeGirParameter, TypeGirProperty, TypeGirFunction } from './index.js';
2
2
  /** Any gir element type */
3
- export declare type TypeGirElement = TypeGirClass | TypeGirMethod | TypeGirVariable | TypeGirAlias | TypeGirEnumeration | TypeGirEnumerationMember | TypeGirInterface | TypeGirParameter | TypeGirProperty | TypeGirFunction;
3
+ export type TypeGirElement = TypeGirClass | TypeGirMethod | TypeGirVariable | TypeGirAlias | TypeGirEnumeration | TypeGirEnumerationMember | TypeGirInterface | TypeGirParameter | TypeGirProperty | TypeGirFunction;
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript enumeration */
2
- export declare type TypeGirEnumerationMember = 'enum-member' | 'bitfield-member';
2
+ export type TypeGirEnumerationMember = 'enum-member' | 'bitfield-member';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript enumeration */
2
- export declare type TypeGirEnumeration = 'enum' | 'bitfield';
2
+ export type TypeGirEnumeration = 'enum' | 'bitfield';
@@ -1 +1 @@
1
- export declare type TypeGirFunction = 'constructor' | 'function' | 'method' | 'static-function' | 'signal' | 'virtual' | 'callback';
1
+ export type TypeGirFunction = 'constructor' | 'function' | 'method' | 'static-function' | 'signal' | 'virtual' | 'callback';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript interface */
2
- export declare type TypeGirInterface = 'callback';
2
+ export type TypeGirInterface = 'callback';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript method (or static function) of a class */
2
- export declare type TypeGirMethod = 'virtual' | 'signal' | 'method' | 'constructor' | 'function' | 'static';
2
+ export type TypeGirMethod = 'virtual' | 'signal' | 'method' | 'constructor' | 'function' | 'static';
@@ -1 +1 @@
1
- export declare type TypeGirParameter = 'callable-param';
1
+ export type TypeGirParameter = 'callable-param';
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript field / property */
2
- export declare type TypeGirProperty = 'property' | 'field' | 'constant';
2
+ export type TypeGirProperty = 'property' | 'field' | 'constant';
@@ -1 +1 @@
1
- export declare type TypeGirVariable = 'constant';
1
+ export type TypeGirVariable = 'constant';
@@ -1,3 +1,3 @@
1
1
  import { TypeTsFunction, TypeTsProperty } from './index.js';
2
2
  /** Any typescript element type */
3
- export declare type TypeTsElement = 'class' | 'interface' | 'enum' | 'enum-member' | 'constant' | 'event-methods' | 'type' | TypeTsFunction | TypeTsProperty;
3
+ export type TypeTsElement = 'class' | 'interface' | 'enum' | 'enum-member' | 'constant' | 'event-methods' | 'type' | TypeTsFunction | TypeTsProperty;
@@ -1,2 +1,2 @@
1
1
  /** All gir elements which can be a typescript enumeration */
2
- export declare type TypeTsEnumerationMember = 'enum-member';
2
+ export type TypeTsEnumerationMember = 'enum-member';
@@ -1 +1 @@
1
- export declare type TypeTsFunction = 'static-function' | 'constructor' | 'function' | 'method' | 'event-methods' | 'interface';
1
+ export type TypeTsFunction = 'static-function' | 'constructor' | 'function' | 'method' | 'event-methods' | 'interface';
@@ -1 +1 @@
1
- export declare type TypeTsProperty = 'static-property' | 'property' | 'constructor-property';
1
+ export type TypeTsProperty = 'static-property' | 'property' | 'constructor-property';
package/lib/utils.d.ts CHANGED
@@ -88,9 +88,16 @@ export declare const girElementIsIntrospectable: (girElement?: {
88
88
  export declare const typeIsOptional: (types: TsType[]) => boolean;
89
89
  /**
90
90
  * 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
- * @see {@link https://github.com/microsoft/TypeScript/blob/5f9c9a6ccf61fa131849797248438e292e7b496a/src/harness/compilerImpl.ts#L11-L35}
92
- * @see {@link https://github.com/microsoft/TypeScript/blob/3fd8a6e44341f14681aa9d303dc380020ccb2147/src/harness/vfsUtil.ts#L286-L316}
93
91
  *
94
92
  * @param path - The directory path to search for a tsconfig.json or jsconfig.json file
95
93
  */
96
- export declare function readTsJsConfig(path: string): Record<PropertyKey, unknown> | null;
94
+ export declare function readTsJsConfig(path: string): {
95
+ compilerOptions?: import("get-tsconfig").TsConfigJson.CompilerOptions | undefined;
96
+ watchOptions?: import("get-tsconfig").TsConfigJson.WatchOptions | undefined;
97
+ typeAcquisition?: import("get-tsconfig").TsConfigJson.TypeAcquisition | undefined;
98
+ compileOnSave?: boolean | undefined;
99
+ files?: string[] | undefined;
100
+ exclude?: string[] | undefined;
101
+ include?: string[] | undefined;
102
+ references?: import("get-tsconfig").TsConfigJson.References[] | undefined;
103
+ } | null;
package/lib/utils.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import lodash from 'lodash';
3
3
  import Path from 'path';
4
4
  import fs from 'fs';
5
- import ts from 'typescript';
5
+ import { getTsconfig } from 'get-tsconfig';
6
6
  import { fileURLToPath } from 'url';
7
7
  import { inspect } from 'util';
8
8
  import { Logger } from './logger.js';
@@ -189,8 +189,8 @@ export const typeIsOptional = (types) => {
189
189
  };
190
190
  function convertTsJsConfigToObject(path) {
191
191
  try {
192
- const config = ts.parseConfigFileTextToJson(Path.basename(path), fs.readFileSync(path, 'utf8').trim()).config;
193
- if (typeof config === 'object' && !Array.isArray(config))
192
+ const config = getTsconfig(path)?.config;
193
+ if (config)
194
194
  return config;
195
195
  }
196
196
  catch {
@@ -200,8 +200,6 @@ function convertTsJsConfigToObject(path) {
200
200
  }
201
201
  /**
202
202
  * 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
- * @see {@link https://github.com/microsoft/TypeScript/blob/5f9c9a6ccf61fa131849797248438e292e7b496a/src/harness/compilerImpl.ts#L11-L35}
204
- * @see {@link https://github.com/microsoft/TypeScript/blob/3fd8a6e44341f14681aa9d303dc380020ccb2147/src/harness/vfsUtil.ts#L286-L316}
205
203
  *
206
204
  * @param path - The directory path to search for a tsconfig.json or jsconfig.json file
207
205
  */
@@ -218,6 +216,6 @@ export function readTsJsConfig(path) {
218
216
  lastPath = currentPath;
219
217
  currentPath = Path.dirname(currentPath);
220
218
  }
221
- return config === false ? null : config;
219
+ return config || null;
222
220
  }
223
221
  //# sourceMappingURL=utils.js.map
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"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,eAAe,CAAC,CAAA;QAC5D,MAAM;YACF,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,yBAAyB,CAAC,YAAY,CAAC,CAAC;gBACxE,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,yBAAyB,CAAC,YAAY,CAAC,CAAC,CAAA;QAC5E,QAAQ,GAAG,WAAW,CAAA;QACtB,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;KAC1C;IAED,OAAO,MAAM,IAAI,IAAI,CAAA;AACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-for-gir/cli",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.7",
4
4
  "description": "Typescript .d.ts generator from GIR for gjs and node-gtk",
5
5
  "module": "lib/index.js",
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "scripts": {
14
14
  "start": "yarn node --max_old_space_size=9216 lib/start.js",
15
- "build": "yarn run clear:build && yarn run lint && yarn run build:ts && yarn run chmod",
15
+ "build": "yarn run lint && yarn run build:ts && yarn run chmod",
16
16
  "chmod": "chmod +x ./lib/start.js",
17
17
  "build:ts": "tsc",
18
18
  "clear": "yarn run clear:build",
@@ -40,33 +40,34 @@
40
40
  "@types/change-case": "^2.3.1",
41
41
  "@types/columnify": "^1.5.1",
42
42
  "@types/ejs": "^3.1.1",
43
- "@types/eslint": "8.4.6",
44
- "@types/inquirer": "^9.0.1",
45
- "@types/lodash": "^4.14.185",
46
- "@types/node": "^18.7.21",
47
- "@types/prettier": "^2.7.1",
43
+ "@types/eslint": "8.4.10",
44
+ "@types/inquirer": "^9.0.3",
45
+ "@types/lodash": "^4.14.191",
46
+ "@types/node": "^18.11.18",
47
+ "@types/prettier": "^2.7.2",
48
48
  "@types/xml2js": "^0.4.11",
49
- "@types/yargs": "^17.0.13",
50
- "@typescript-eslint/eslint-plugin": "^5.38.0",
51
- "@typescript-eslint/parser": "^5.38.0",
52
- "eslint": "^8.24.0",
53
- "eslint-config-prettier": "^8.5.0",
49
+ "@types/yargs": "^17.0.19",
50
+ "@typescript-eslint/eslint-plugin": "^5.48.2",
51
+ "@typescript-eslint/parser": "^5.48.2",
52
+ "eslint": "^8.32.0",
53
+ "eslint-config-prettier": "^8.6.0",
54
54
  "eslint-plugin-prettier": "^4.2.1",
55
- "rimraf": "^3.0.2"
55
+ "rimraf": "^4.1.0",
56
+ "typescript": "^4.9.4"
56
57
  },
57
58
  "dependencies": {
58
59
  "colorette": "^2.0.19",
59
60
  "columnify": "^1.6.0",
60
- "cosmiconfig": "^7.0.1",
61
+ "cosmiconfig": "^8.0.0",
61
62
  "ejs": "^3.1.8",
62
63
  "events": "^3.3.0",
63
- "globby": "^13.1.2",
64
- "inquirer": "^9.1.2",
64
+ "get-tsconfig": "^4.3.0",
65
+ "globby": "^13.1.3",
66
+ "inquirer": "^9.1.4",
65
67
  "lodash": "^4.17.21",
66
- "prettier": "^2.7.1",
68
+ "prettier": "^2.8.3",
67
69
  "tiny-glob": "^0.2.9",
68
- "typescript": "^4.8.3",
69
70
  "xml2js": "^0.4.23",
70
- "yargs": "^17.5.1"
71
+ "yargs": "^17.6.2"
71
72
  }
72
73
  }
package/src/config.ts CHANGED
@@ -35,7 +35,7 @@ export class Config {
35
35
  girDirectories: OS.platform() === 'darwin' ? ['/usr/local/share/gir-1.0'] : ['/usr/share/gir-1.0'],
36
36
  modules: ['*'],
37
37
  ignore: [],
38
- verbose: true,
38
+ verbose: false,
39
39
  ignoreVersionConflicts: false,
40
40
  useNamespace: false,
41
41
  buildType: 'lib',
@@ -295,23 +295,12 @@ export class Config {
295
295
  }
296
296
 
297
297
  protected static async validateTsConfig(config: UserConfig): Promise<UserConfig> {
298
- const tsConfig = config.outdir ? readTsJsConfig(config.outdir) : null
299
-
300
- const tsCompilerOptions = (
301
- tsConfig &&
302
- 'compilerOptions' in tsConfig &&
303
- typeof tsConfig.compilerOptions === 'object' &&
304
- tsConfig.compilerOptions != null
305
- ? tsConfig.compilerOptions
306
- : {}
307
- ) as Record<PropertyKey, unknown>
308
-
309
- const tsConfigHasDOMLib =
310
- 'noLib' in tsCompilerOptions && tsCompilerOptions.noLib
311
- ? false // NoLib makes typescript to ignore the lib property
312
- : 'lib' in tsCompilerOptions && Array.isArray(tsCompilerOptions.lib)
313
- ? tsCompilerOptions.lib.some((lib) => String(lib).toLowerCase().startsWith('dom'))
314
- : true // Typescript icludes DOM lib by default
298
+ const tsCompilerOptions = (config.outdir && readTsJsConfig(config.outdir)?.compilerOptions) || {}
299
+ const tsConfigHasDOMLib = tsCompilerOptions.noLib
300
+ ? false // NoLib makes typescript to ignore the lib property
301
+ : Array.isArray(tsCompilerOptions.lib)
302
+ ? tsCompilerOptions.lib.some((lib) => lib.toLowerCase().startsWith('dom'))
303
+ : true // Typescript icludes DOM lib by default
315
304
 
316
305
  if (config.environments.includes('gjs') && tsConfigHasDOMLib && !config.noDOMLib) {
317
306
  const answer = (
@@ -358,7 +347,7 @@ export class Config {
358
347
  * @param options
359
348
  */
360
349
  public static async load(options: ConfigFlags): Promise<UserConfig> {
361
- const configFile = await this.loadConfigFile(options.configName)
350
+ const configFile = (await this.loadConfigFile(options.configName))?.config || {}
362
351
 
363
352
  const config: UserConfig = {
364
353
  environments: options.environments,
@@ -382,96 +371,90 @@ export class Config {
382
371
 
383
372
  if (configFile) {
384
373
  // environments
385
- if (isEqual(config.environments, Config.defaults.environments) && configFile.config.environments) {
386
- config.environments = configFile.config.environments
374
+ if (isEqual(config.environments, Config.defaults.environments) && configFile.environments) {
375
+ config.environments = configFile.environments
387
376
  }
388
377
  // buildType
389
- if (config.buildType === Config.options.buildType.default && configFile.config.buildType) {
390
- config.buildType = configFile.config.buildType
378
+ if (config.buildType === Config.options.buildType.default && configFile.buildType) {
379
+ config.buildType = configFile.buildType
391
380
  }
392
381
  // moduleType
393
- if (config.moduleType === Config.options.moduleType.default && configFile.config.moduleType) {
394
- config.moduleType = configFile.config.moduleType
382
+ if (config.moduleType === Config.options.moduleType.default && configFile.moduleType) {
383
+ config.moduleType = configFile.moduleType
395
384
  }
396
385
  // verbose
397
- if (config.verbose === Config.options.verbose.default && typeof configFile.config.verbose === 'boolean') {
398
- config.verbose = configFile.config.verbose
386
+ if (config.verbose === Config.options.verbose.default && typeof configFile.verbose === 'boolean') {
387
+ config.verbose = configFile.verbose
399
388
  }
400
389
  // ignoreVersionConflicts
401
390
  if (
402
391
  config.ignoreVersionConflicts === Config.options.ignoreVersionConflicts.default &&
403
- typeof configFile.config.ignoreVersionConflicts === 'boolean'
392
+ typeof configFile.ignoreVersionConflicts === 'boolean'
404
393
  ) {
405
- config.ignoreVersionConflicts = configFile.config.ignoreVersionConflicts
394
+ config.ignoreVersionConflicts = configFile.ignoreVersionConflicts
406
395
  }
407
396
  // pretty
408
- if (config.pretty === Config.options.pretty.default && typeof configFile.config.pretty === 'boolean') {
409
- config.pretty = configFile.config.pretty
397
+ if (config.pretty === Config.options.pretty.default && typeof configFile.pretty === 'boolean') {
398
+ config.pretty = configFile.pretty
410
399
  }
411
400
  // print
412
- if (config.print === Config.options.print.default && typeof configFile.config.print === 'boolean') {
413
- config.print = configFile.config.print
401
+ if (config.print === Config.options.print.default && typeof configFile.print === 'boolean') {
402
+ config.print = configFile.print
414
403
  }
415
404
  // outdir
416
- if (config.outdir === Config.options.outdir.default && configFile.config.outdir) {
417
- config.outdir = config.print ? null : configFile.config.outdir
405
+ if (config.outdir === Config.options.outdir.default && configFile.outdir) {
406
+ config.outdir = config.print ? null : configFile.outdir
418
407
  }
419
408
  // girDirectories
420
- if (config.girDirectories === Config.options.girDirectories.default && configFile.config.girDirectories) {
421
- config.girDirectories = configFile.config.girDirectories
409
+ if (config.girDirectories === Config.options.girDirectories.default && configFile.girDirectories) {
410
+ config.girDirectories = configFile.girDirectories
422
411
  }
423
412
  // ignore
424
413
  if (
425
414
  (!config.ignore || config.ignore.length <= 0 || isEqual(config.ignore, Config.defaults.ignore)) &&
426
- configFile.config.ignore
415
+ configFile.ignore
427
416
  ) {
428
- config.ignore = configFile.config.ignore
417
+ config.ignore = configFile.ignore
429
418
  }
430
419
  // modules
431
420
  if (
432
421
  (config.modules.length <= 0 || isEqual(config.modules, Config.defaults.modules)) &&
433
- configFile.config.modules
422
+ configFile.modules
434
423
  ) {
435
- config.modules = configFile.config.modules
424
+ config.modules = configFile.modules
436
425
  }
437
426
  // useNamespace
438
427
  if (
439
428
  config.useNamespace === Config.options.useNamespace.default &&
440
- typeof configFile.config.useNamespace === 'boolean'
429
+ typeof configFile.useNamespace === 'boolean'
441
430
  ) {
442
- config.useNamespace = configFile.config.useNamespace
431
+ config.useNamespace = configFile.useNamespace
443
432
  }
444
433
  // noComments
445
- if (
446
- config.noComments === Config.options.noComments.default &&
447
- typeof configFile.config.noComments === 'boolean'
448
- ) {
449
- config.noComments = configFile.config.noComments
434
+ if (config.noComments === Config.options.noComments.default && typeof configFile.noComments === 'boolean') {
435
+ config.noComments = configFile.noComments
450
436
  }
451
437
  // noDebugComments
452
438
  if (
453
439
  config.noDebugComments === Config.options.noDebugComments.default &&
454
- typeof configFile.config.noDebugComments === 'boolean'
440
+ typeof configFile.noDebugComments === 'boolean'
455
441
  ) {
456
- config.noDebugComments = configFile.config.noDebugComments
442
+ config.noDebugComments = configFile.noDebugComments
457
443
  }
458
444
  // noCheck
459
- if (config.noCheck === Config.options.noCheck.default && typeof configFile.config.noCheck === 'boolean') {
460
- config.noCheck = configFile.config.noCheck
445
+ if (config.noCheck === Config.options.noCheck.default && typeof configFile.noCheck === 'boolean') {
446
+ config.noCheck = configFile.noCheck
461
447
  }
462
448
  // fixConflicts
463
449
  if (
464
450
  config.fixConflicts === Config.options.fixConflicts.default &&
465
- typeof configFile.config.fixConflicts === 'boolean'
451
+ typeof configFile.fixConflicts === 'boolean'
466
452
  ) {
467
- config.fixConflicts = configFile.config.fixConflicts
453
+ config.fixConflicts = configFile.fixConflicts
468
454
  }
469
455
  // noDOMLib
470
- if (
471
- config.noDOMLib === Config.options.noDOMLib.default &&
472
- typeof configFile.config.noDOMLib === 'boolean'
473
- ) {
474
- config.noDOMLib = configFile.config.noDOMLib
456
+ if (config.noDOMLib === Config.options.noDOMLib.default && typeof configFile.noDOMLib === 'boolean') {
457
+ config.noDOMLib = configFile.noDOMLib
475
458
  }
476
459
  }
477
460
 
@@ -69,7 +69,7 @@ export class TemplateProcessor {
69
69
  const destPath = getDestPath(this.config.environment, outputDir, outputFilename)
70
70
 
71
71
  // write template result file
72
- mkdirSync(outputDir, { recursive: true })
72
+ mkdirSync(Path.dirname(destPath), { recursive: true })
73
73
  writeFileSync(destPath, content, { encoding: 'utf8', flag: 'w' })
74
74
 
75
75
  return Promise.resolve(destPath)
@@ -57,8 +57,8 @@ export default class TypeDefinitionGenerator implements Generator {
57
57
  */
58
58
  private generateModuleDependenciesImport(namespace: string, packageName: string, asExternType = false): string[] {
59
59
  const def: string[] = []
60
+ const sas = this.config.useNamespace && packageName !== 'Gjs' ? '' : '* as '
60
61
  if (this.config.buildType === 'lib') {
61
- const sas = this.config.useNamespace && packageName !== 'Gjs' ? '' : '* as '
62
62
  def.push(`import type ${sas}${namespace} from './${packageName}.js';`)
63
63
  } else if (this.config.buildType === 'types') {
64
64
  if (asExternType) {
@@ -66,7 +66,7 @@ export default class TypeDefinitionGenerator implements Generator {
66
66
  def.push(`import ${namespace} from "${packageName}.js"`)
67
67
  } else {
68
68
  def.push(`/// <reference path="${packageName}.d.ts" />`)
69
- def.push(`import type ${namespace} from './${packageName}.js';`)
69
+ def.push(`import type ${sas}${namespace} from './${packageName}.js';`)
70
70
  }
71
71
  }
72
72
  return def
@@ -1357,7 +1357,7 @@ export default class TypeDefinitionGenerator implements Generator {
1357
1357
  out.push(`}`)
1358
1358
  }
1359
1359
 
1360
- if (this.config.buildType !== 'types' && this.config.useNamespace) {
1360
+ if (this.config.useNamespace) {
1361
1361
  out.push(`export default ${girModule.namespace};`)
1362
1362
  }
1363
1363
 
@@ -1406,24 +1406,19 @@ export default class TypeDefinitionGenerator implements Generator {
1406
1406
 
1407
1407
  // Types
1408
1408
  await templateProcessor.create('Gjs.d.ts', this.config.outdir, 'Gjs.d.ts')
1409
+ await templateProcessor.create('GnomeShell.d.ts', this.config.outdir, 'GnomeShell.d.ts')
1410
+ await templateProcessor.create('misc/extensionUtils.d.ts', this.config.outdir, 'misc/extensionUtils.d.ts')
1409
1411
  await templateProcessor.create('index.d.ts', this.config.outdir, 'index.d.ts')
1410
1412
 
1411
1413
  // Lib
1412
1414
  if (this.config.buildType === 'lib') {
1415
+ await templateProcessor.create('Gjs.js', this.config.outdir, 'Gjs.js')
1416
+ await templateProcessor.create('GnomeShell.js', this.config.outdir, 'GnomeShell.js')
1417
+ await templateProcessor.create('misc/extensionUtils.js', this.config.outdir, 'misc/extensionUtils.js')
1413
1418
  await templateProcessor.create('index.js', this.config.outdir, 'index.js')
1414
- const template = 'Gjs.js'
1415
- await templateProcessor.create(template, this.config.outdir, 'Gjs.js')
1416
1419
  }
1417
1420
  }
1418
1421
 
1419
- private async exportGjsCastLib(inheritanceTable: InheritanceTable) {
1420
- if (!this.config.outdir) return
1421
-
1422
- const inheritanceTableKeys = Object.keys(inheritanceTable)
1423
- const templateProcessor = new TemplateProcessor({ inheritanceTableKeys, inheritanceTable }, 'gjs', this.config)
1424
- await templateProcessor.create('cast.ts', this.config.outdir, 'cast.ts')
1425
- }
1426
-
1427
1422
  private async exportNodeGtk(girModules: GirModule[], girModulesGrouped: GirModulesGrouped[]) {
1428
1423
  if (!this.config.outdir) return
1429
1424
 
@@ -1452,7 +1447,6 @@ export default class TypeDefinitionGenerator implements Generator {
1452
1447
  if (this.config.environment === 'gjs' && girModulesGrouped && inheritanceTable) {
1453
1448
  // GJS internal stuff
1454
1449
  await this.exportGjs(girModules, girModulesGrouped)
1455
- await this.exportGjsCastLib(inheritanceTable)
1456
1450
  }
1457
1451
  }
1458
1452
  }
package/src/utils.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import lodash from 'lodash'
3
3
  import Path from 'path'
4
4
  import fs from 'fs'
5
- import ts from 'typescript'
5
+ import { getTsconfig, TsConfigJsonResolved } from 'get-tsconfig'
6
6
  import { fileURLToPath } from 'url'
7
7
  import { Environment, GirInfoAttrs, TsType } from './types/index.js'
8
8
  import { inspect } from 'util'
@@ -219,11 +219,8 @@ export const typeIsOptional = (types: TsType[]) => {
219
219
 
220
220
  function convertTsJsConfigToObject(path: string) {
221
221
  try {
222
- const config: unknown = ts.parseConfigFileTextToJson(
223
- Path.basename(path),
224
- fs.readFileSync(path, 'utf8').trim(),
225
- ).config
226
- if (typeof config === 'object' && !Array.isArray(config)) return config as Record<PropertyKey, unknown>
222
+ const config = getTsconfig(path)?.config
223
+ if (config) return config
227
224
  } catch {
228
225
  // ignored
229
226
  }
@@ -232,13 +229,11 @@ function convertTsJsConfigToObject(path: string) {
232
229
 
233
230
  /**
234
231
  * 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.
235
- * @see {@link https://github.com/microsoft/TypeScript/blob/5f9c9a6ccf61fa131849797248438e292e7b496a/src/harness/compilerImpl.ts#L11-L35}
236
- * @see {@link https://github.com/microsoft/TypeScript/blob/3fd8a6e44341f14681aa9d303dc380020ccb2147/src/harness/vfsUtil.ts#L286-L316}
237
232
  *
238
233
  * @param path - The directory path to search for a tsconfig.json or jsconfig.json file
239
234
  */
240
235
  export function readTsJsConfig(path: string) {
241
- let config: null | false | Record<PropertyKey, unknown> = null
236
+ let config: null | false | TsConfigJsonResolved = null
242
237
  let lastPath = ''
243
238
  let currentPath = Path.resolve(path)
244
239
  while (!config && currentPath !== lastPath) {
@@ -251,5 +246,5 @@ export function readTsJsConfig(path: string) {
251
246
  currentPath = Path.dirname(currentPath)
252
247
  }
253
248
 
254
- return config === false ? null : config
249
+ return config || null
255
250
  }
@@ -93,10 +93,12 @@ export namespace gettext {
93
93
  export function dcgettext(domainname: string | null, msgid: string, category: number): string
94
94
  export function ngettext(msgid: string, msgid_plural: string, n: number): string
95
95
  export function dngettext(domainname: string, msgid: string, msgid_plural: string, n: number): string
96
+ export function pgettext(context: string, msgid: string): string
97
+ export function dpgettext(dom: string | null, context: string, msgid: string): string
96
98
  export function domain(domainName: string): {
97
99
  gettext: (msgid: string) => string
98
100
  ngettext: (msgid: string, msgid_plural: string, n: number) => string
99
- pgettext: (context: any, msgid: string) => any
101
+ pgettext: (context: string, msgid: string) => string
100
102
  }
101
103
  }
102
104