@ts-for-gir/cli 3.2.0 → 3.2.2
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.
- package/lib/generation-handler.js.map +1 -1
- package/package.json +15 -15
- package/src/generation-handler.ts +4 -1
- package/lib/utils.d.ts +0 -30
- package/lib/utils.js +0 -40
- package/lib/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generation-handler.js","sourceRoot":"","sources":["../src/generation-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EACH,SAAS,EACT,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,GAC5B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,aAAa,EAAa,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAIjE,MAAM,OAAO,iBAAiB;
|
|
1
|
+
{"version":3,"file":"generation-handler.js","sourceRoot":"","sources":["../src/generation-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EACH,SAAS,EACT,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,GAC5B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,aAAa,EAAa,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAIjE,MAAM,OAAO,iBAAiB;IAIL;IAHrB,GAAG,CAAQ;IACX,SAAS,CAAW;IACpB,YACqB,MAAsB,EACvC,IAAmB;QADF,WAAM,G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U,CAAA;QAEpC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;QAEhC,MAAM,gBAAgB,GAAqB,EAAE,CAAA;QAC7C,KAAK,MAAM,SAAS,IAAI,UAAU;YAAE,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAEpE,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAA;QAE1C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;QAElC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAChC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;gBACpB,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;aACvD;YACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,SAAS,CAAC,WAAW,MAAM,CAAC,CAAA;YAC/C,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;SAC9B;QAED,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,CAAA;QAE3E,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAC3C,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-for-gir/cli",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "TypeScript type definition generator for GObject introspection GIR files",
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -55,26 +55,26 @@
|
|
|
55
55
|
],
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/inquirer": "^9.0.3",
|
|
58
|
-
"@types/node": "^
|
|
58
|
+
"@types/node": "^20.6.2",
|
|
59
59
|
"@types/yargs": "^17.0.24",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
61
|
-
"@typescript-eslint/parser": "^
|
|
62
|
-
"eslint": "^8.
|
|
63
|
-
"eslint-config-prettier": "^
|
|
64
|
-
"eslint-plugin-prettier": "^
|
|
65
|
-
"prettier": "^
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
61
|
+
"@typescript-eslint/parser": "^6.7.0",
|
|
62
|
+
"eslint": "^8.49.0",
|
|
63
|
+
"eslint-config-prettier": "^9.0.0",
|
|
64
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
65
|
+
"prettier": "^3.0.3",
|
|
66
66
|
"rimraf": "^5.0.1",
|
|
67
67
|
"ts-node": "^10.9.1",
|
|
68
|
-
"typescript": "^5.
|
|
68
|
+
"typescript": "^5.2.2"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@ts-for-gir/generator-base": "^3.2.
|
|
72
|
-
"@ts-for-gir/generator-html-doc": "^3.2.
|
|
73
|
-
"@ts-for-gir/generator-typescript": "^3.2.
|
|
74
|
-
"@ts-for-gir/lib": "^3.2.
|
|
71
|
+
"@ts-for-gir/generator-base": "^3.2.2",
|
|
72
|
+
"@ts-for-gir/generator-html-doc": "^3.2.2",
|
|
73
|
+
"@ts-for-gir/generator-typescript": "^3.2.2",
|
|
74
|
+
"@ts-for-gir/lib": "^3.2.2",
|
|
75
75
|
"colorette": "^2.0.20",
|
|
76
|
-
"cosmiconfig": "^8.
|
|
77
|
-
"inquirer": "^9.2.
|
|
76
|
+
"cosmiconfig": "^8.3.6",
|
|
77
|
+
"inquirer": "^9.2.11",
|
|
78
78
|
"tiny-glob": "^0.2.9",
|
|
79
79
|
"yargs": "^17.7.2"
|
|
80
80
|
}
|
|
@@ -17,7 +17,10 @@ import type { InheritanceTable, GenerateConfig, GirModulesGrouped } from '@ts-fo
|
|
|
17
17
|
export class GenerationHandler {
|
|
18
18
|
log: Logger
|
|
19
19
|
generator: Generator
|
|
20
|
-
constructor(
|
|
20
|
+
constructor(
|
|
21
|
+
private readonly config: GenerateConfig,
|
|
22
|
+
type: GeneratorType,
|
|
23
|
+
) {
|
|
21
24
|
this.log = new Logger(config.environment, config.verbose, 'GenerationHandler')
|
|
22
25
|
|
|
23
26
|
switch (type) {
|
package/lib/utils.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get a typescript or javascript config by path
|
|
3
|
-
* @param path The path to search for a tsconfig.json or jsconfig.json file
|
|
4
|
-
* @returns The config or null if not found
|
|
5
|
-
*/
|
|
6
|
-
export declare const getTsJsConfigByPath: (path: string) => {
|
|
7
|
-
compilerOptions?: import("get-tsconfig").TsConfigJson.CompilerOptions | undefined;
|
|
8
|
-
watchOptions?: import("get-tsconfig").TsConfigJson.WatchOptions | undefined;
|
|
9
|
-
typeAcquisition?: import("get-tsconfig").TsConfigJson.TypeAcquisition | undefined;
|
|
10
|
-
compileOnSave?: boolean | undefined;
|
|
11
|
-
files?: string[] | undefined;
|
|
12
|
-
exclude?: string[] | undefined;
|
|
13
|
-
include?: string[] | undefined;
|
|
14
|
-
references?: import("get-tsconfig").TsConfigJson.References[] | undefined;
|
|
15
|
-
} | null;
|
|
16
|
-
/**
|
|
17
|
-
* 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.
|
|
18
|
-
*
|
|
19
|
-
* @param path - The directory path to search for a tsconfig.json or jsconfig.json file
|
|
20
|
-
*/
|
|
21
|
-
export declare function readTsJsConfig(path: string): {
|
|
22
|
-
compilerOptions?: import("get-tsconfig").TsConfigJson.CompilerOptions | undefined;
|
|
23
|
-
watchOptions?: import("get-tsconfig").TsConfigJson.WatchOptions | undefined;
|
|
24
|
-
typeAcquisition?: import("get-tsconfig").TsConfigJson.TypeAcquisition | undefined;
|
|
25
|
-
compileOnSave?: boolean | undefined;
|
|
26
|
-
files?: string[] | undefined;
|
|
27
|
-
exclude?: string[] | undefined;
|
|
28
|
-
include?: string[] | undefined;
|
|
29
|
-
references?: import("get-tsconfig").TsConfigJson.References[] | undefined;
|
|
30
|
-
} | null;
|
package/lib/utils.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { join, dirname, resolve } from 'path';
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import { getTsconfig } from 'get-tsconfig';
|
|
4
|
-
/**
|
|
5
|
-
* Get a typescript or javascript config by path
|
|
6
|
-
* @param path The path to search for a tsconfig.json or jsconfig.json file
|
|
7
|
-
* @returns The config or null if not found
|
|
8
|
-
*/
|
|
9
|
-
export const getTsJsConfigByPath = (path) => {
|
|
10
|
-
try {
|
|
11
|
-
const config = getTsconfig(path)?.config;
|
|
12
|
-
if (config)
|
|
13
|
-
return config;
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
// ignored
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* 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.
|
|
22
|
-
*
|
|
23
|
-
* @param path - The directory path to search for a tsconfig.json or jsconfig.json file
|
|
24
|
-
*/
|
|
25
|
-
export function readTsJsConfig(path) {
|
|
26
|
-
let config = null;
|
|
27
|
-
let lastPath = '';
|
|
28
|
-
let currentPath = resolve(path);
|
|
29
|
-
while (!config && currentPath !== lastPath) {
|
|
30
|
-
const tsConfigPath = join(currentPath, 'tsconfig.json');
|
|
31
|
-
const jsConfigPath = join(currentPath, 'jsconfig.json');
|
|
32
|
-
config =
|
|
33
|
-
(existsSync(tsConfigPath) && getTsJsConfigByPath(tsConfigPath)) ||
|
|
34
|
-
(existsSync(jsConfigPath) && getTsJsConfigByPath(jsConfigPath));
|
|
35
|
-
lastPath = currentPath;
|
|
36
|
-
currentPath = dirname(currentPath);
|
|
37
|
-
}
|
|
38
|
-
return config || null;
|
|
39
|
-
}
|
|
40
|
-
//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