@ts-for-gir/cli 4.0.0-beta.31 → 4.0.0-beta.32
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/bin/ts-for-gir +56 -62
- package/package.json +9 -9
package/bin/ts-for-gir
CHANGED
|
@@ -3333,7 +3333,7 @@ var require_lodash = __commonJS({
|
|
|
3333
3333
|
}
|
|
3334
3334
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
3335
3335
|
});
|
|
3336
|
-
function
|
|
3336
|
+
function join10(array, separator) {
|
|
3337
3337
|
return array == null ? "" : nativeJoin.call(array, separator);
|
|
3338
3338
|
}
|
|
3339
3339
|
function last(array) {
|
|
@@ -5252,7 +5252,7 @@ var require_lodash = __commonJS({
|
|
|
5252
5252
|
lodash2.isUndefined = isUndefined;
|
|
5253
5253
|
lodash2.isWeakMap = isWeakMap;
|
|
5254
5254
|
lodash2.isWeakSet = isWeakSet;
|
|
5255
|
-
lodash2.join =
|
|
5255
|
+
lodash2.join = join10;
|
|
5256
5256
|
lodash2.kebabCase = kebabCase;
|
|
5257
5257
|
lodash2.last = last;
|
|
5258
5258
|
lodash2.lastIndexOf = lastIndexOf;
|
|
@@ -5515,19 +5515,17 @@ import { blue, gray, green, red, yellow, yellowBright } from "colorette";
|
|
|
5515
5515
|
|
|
5516
5516
|
// ../reporter/src/constants.ts
|
|
5517
5517
|
import { readFileSync } from "node:fs";
|
|
5518
|
-
import {
|
|
5519
|
-
import {
|
|
5520
|
-
var require2 = createRequire(import.meta.url);
|
|
5518
|
+
import { dirname, join } from "node:path";
|
|
5519
|
+
import { fileURLToPath } from "node:url";
|
|
5521
5520
|
function resolvePackageJson() {
|
|
5522
5521
|
try {
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
}
|
|
5522
|
+
const currentModulePath = fileURLToPath(import.meta.url);
|
|
5523
|
+
const currentDir = dirname(currentModulePath);
|
|
5524
|
+
const packageRoot = join(currentDir, "..");
|
|
5525
|
+
const packageJsonPath = join(packageRoot, "package.json");
|
|
5526
|
+
return packageJsonPath;
|
|
5527
|
+
} catch (error) {
|
|
5528
|
+
throw new Error(`Unable to resolve package.json path: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
5531
5529
|
}
|
|
5532
5530
|
}
|
|
5533
5531
|
function readPackage() {
|
|
@@ -5542,8 +5540,6 @@ function readPackage() {
|
|
|
5542
5540
|
}
|
|
5543
5541
|
var PACKAGE = readPackage();
|
|
5544
5542
|
var PACKAGE_VERSION = PACKAGE.version;
|
|
5545
|
-
var PACKAGE_NAME = PACKAGE.name;
|
|
5546
|
-
var PACKAGE_DESCRIPTION = PACKAGE.description;
|
|
5547
5543
|
|
|
5548
5544
|
// ../reporter/src/types/problem.ts
|
|
5549
5545
|
var ProblemSeverity = /* @__PURE__ */ ((ProblemSeverity2) => {
|
|
@@ -6184,7 +6180,7 @@ ${"=".repeat(50)}`);
|
|
|
6184
6180
|
|
|
6185
6181
|
// ../reporter/src/reporter-service.ts
|
|
6186
6182
|
import { writeFile as writeFile2 } from "node:fs/promises";
|
|
6187
|
-
import { resolve
|
|
6183
|
+
import { resolve } from "node:path";
|
|
6188
6184
|
import { blue as blue2, green as green2, red as red2, yellow as yellow2 } from "colorette";
|
|
6189
6185
|
var ReporterService = class _ReporterService {
|
|
6190
6186
|
static instance = null;
|
|
@@ -6451,7 +6447,7 @@ var ReporterService = class _ReporterService {
|
|
|
6451
6447
|
const report = this.generateComprehensiveReport();
|
|
6452
6448
|
const filePath = outputPath || this.config.outputPath;
|
|
6453
6449
|
try {
|
|
6454
|
-
const fullPath =
|
|
6450
|
+
const fullPath = resolve(process.cwd(), filePath);
|
|
6455
6451
|
await writeFile2(fullPath, JSON.stringify(report, null, 2), "utf-8");
|
|
6456
6452
|
console.log(`\u{1F4CA} Comprehensive report saved to: ${fullPath}`);
|
|
6457
6453
|
} catch (error) {
|
|
@@ -6534,27 +6530,25 @@ ${"=".repeat(60)}`);
|
|
|
6534
6530
|
};
|
|
6535
6531
|
|
|
6536
6532
|
// ../lib/src/constants.ts
|
|
6537
|
-
import {
|
|
6538
|
-
import { dirname as dirname2,
|
|
6539
|
-
|
|
6533
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
6534
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
6535
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
6540
6536
|
var NEW_LINE_REG_EXP = /[\n\r]+/g;
|
|
6541
6537
|
function resolvePackageJson2() {
|
|
6542
6538
|
try {
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
}
|
|
6539
|
+
const currentModulePath = fileURLToPath2(import.meta.url);
|
|
6540
|
+
const currentDir = dirname2(currentModulePath);
|
|
6541
|
+
const packageRoot = join2(currentDir, "..");
|
|
6542
|
+
const packageJsonPath = join2(packageRoot, "package.json");
|
|
6543
|
+
return packageJsonPath;
|
|
6544
|
+
} catch (error) {
|
|
6545
|
+
throw new Error(`Unable to resolve package.json path: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
6551
6546
|
}
|
|
6552
6547
|
}
|
|
6553
6548
|
function readPackageSync() {
|
|
6554
6549
|
try {
|
|
6555
6550
|
const packagePath = resolvePackageJson2();
|
|
6556
|
-
const
|
|
6557
|
-
const content = readFileSync3(packagePath, "utf-8");
|
|
6551
|
+
const content = readFileSync2(packagePath, "utf-8");
|
|
6558
6552
|
return JSON.parse(content);
|
|
6559
6553
|
} catch (error) {
|
|
6560
6554
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -8175,7 +8169,7 @@ var Logger = class _Logger {
|
|
|
8175
8169
|
// ../lib/src/utils/files.ts
|
|
8176
8170
|
import { constants } from "node:fs";
|
|
8177
8171
|
import { access, readFile } from "node:fs/promises";
|
|
8178
|
-
import { join } from "node:path";
|
|
8172
|
+
import { join as join3 } from "node:path";
|
|
8179
8173
|
import { glob } from "glob";
|
|
8180
8174
|
var fileExists = async (filePath) => {
|
|
8181
8175
|
try {
|
|
@@ -8187,7 +8181,7 @@ var fileExists = async (filePath) => {
|
|
|
8187
8181
|
};
|
|
8188
8182
|
var findFilesInDirs = async (dirs, filename) => {
|
|
8189
8183
|
const filesInfo = [];
|
|
8190
|
-
const pattern = dirs.map((dir) =>
|
|
8184
|
+
const pattern = dirs.map((dir) => join3(dir, filename));
|
|
8191
8185
|
const _files = await glob(pattern);
|
|
8192
8186
|
const files = [...new Set(_files)];
|
|
8193
8187
|
for (const filePath of files) {
|
|
@@ -15945,10 +15939,10 @@ var GENERATING_TYPES_DONE = "Done.";
|
|
|
15945
15939
|
|
|
15946
15940
|
// ../lib/src/templates/template-engine.ts
|
|
15947
15941
|
import { mkdir, readdir, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
|
|
15948
|
-
import { createRequire
|
|
15949
|
-
import { dirname as dirname3, extname, join as
|
|
15942
|
+
import { createRequire } from "node:module";
|
|
15943
|
+
import { dirname as dirname3, extname, join as join4, resolve as resolve2 } from "node:path";
|
|
15950
15944
|
import ejs from "ejs";
|
|
15951
|
-
var
|
|
15945
|
+
var require2 = createRequire(import.meta.url);
|
|
15952
15946
|
var TemplateEngine = class {
|
|
15953
15947
|
log;
|
|
15954
15948
|
templateDir;
|
|
@@ -15962,9 +15956,9 @@ var TemplateEngine = class {
|
|
|
15962
15956
|
*/
|
|
15963
15957
|
resolveTemplateDirectory() {
|
|
15964
15958
|
try {
|
|
15965
|
-
return
|
|
15959
|
+
return join4(dirname3(require2.resolve("@ts-for-gir/templates/package.json")), "templates");
|
|
15966
15960
|
} catch (_error) {
|
|
15967
|
-
return
|
|
15961
|
+
return resolve2(process.cwd(), "../../templates/templates");
|
|
15968
15962
|
}
|
|
15969
15963
|
}
|
|
15970
15964
|
/**
|
|
@@ -15986,7 +15980,7 @@ var TemplateEngine = class {
|
|
|
15986
15980
|
* Checks if the template file or directory exists and returns the path if found
|
|
15987
15981
|
*/
|
|
15988
15982
|
async exists(templateFilename) {
|
|
15989
|
-
const fullTemplatePath =
|
|
15983
|
+
const fullTemplatePath = join4(this.templateDir, templateFilename);
|
|
15990
15984
|
if (await fileExists(fullTemplatePath)) {
|
|
15991
15985
|
return fullTemplatePath;
|
|
15992
15986
|
}
|
|
@@ -16026,7 +16020,7 @@ var TemplateEngine = class {
|
|
|
16026
16020
|
}
|
|
16027
16021
|
const results = {};
|
|
16028
16022
|
for (const file of files) {
|
|
16029
|
-
const content = await readFile3(
|
|
16023
|
+
const content = await readFile3(join4(path, file), "utf8");
|
|
16030
16024
|
results[file] = this.removeTypeScriptDirectives(content);
|
|
16031
16025
|
}
|
|
16032
16026
|
return results;
|
|
@@ -16397,29 +16391,29 @@ function mergeDescs(descs, comment, indentCount = 1) {
|
|
|
16397
16391
|
}
|
|
16398
16392
|
|
|
16399
16393
|
// ../lib/src/utils/path.ts
|
|
16400
|
-
import { dirname as dirname4, resolve as
|
|
16401
|
-
import { fileURLToPath } from "node:url";
|
|
16402
|
-
var __filename =
|
|
16403
|
-
var __dirname =
|
|
16394
|
+
import { dirname as dirname4, resolve as resolve3 } from "node:path";
|
|
16395
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
16396
|
+
var __filename = fileURLToPath3(import.meta.url);
|
|
16397
|
+
var __dirname = resolve3(dirname4(__filename), "../..");
|
|
16404
16398
|
|
|
16405
16399
|
// src/start.ts
|
|
16406
16400
|
import yargs from "yargs";
|
|
16407
16401
|
import { hideBin } from "yargs/helpers";
|
|
16408
16402
|
|
|
16409
16403
|
// src/commands/analyze.ts
|
|
16410
|
-
import { existsSync as existsSync2, readFileSync as
|
|
16404
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3, writeFileSync } from "node:fs";
|
|
16411
16405
|
|
|
16412
16406
|
// src/config/config-loader.ts
|
|
16413
|
-
import { dirname as dirname5, resolve as
|
|
16407
|
+
import { dirname as dirname5, resolve as resolve4 } from "node:path";
|
|
16414
16408
|
import { cosmiconfig } from "cosmiconfig";
|
|
16415
16409
|
|
|
16416
16410
|
// src/config/config-writer.ts
|
|
16417
16411
|
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
16418
|
-
import { extname as extname2, join as
|
|
16412
|
+
import { extname as extname2, join as join6 } from "node:path";
|
|
16419
16413
|
|
|
16420
16414
|
// src/config/defaults.ts
|
|
16421
16415
|
import { existsSync } from "node:fs";
|
|
16422
|
-
import { join as
|
|
16416
|
+
import { join as join5 } from "node:path";
|
|
16423
16417
|
var defaults = {
|
|
16424
16418
|
print: false,
|
|
16425
16419
|
configName: ".ts-for-girrc.js",
|
|
@@ -16455,7 +16449,7 @@ function getDefaultGirDirectories() {
|
|
|
16455
16449
|
];
|
|
16456
16450
|
const dataDirs = process.env.XDG_DATA_DIRS?.split(":") || [];
|
|
16457
16451
|
for (let dataDir of dataDirs) {
|
|
16458
|
-
dataDir =
|
|
16452
|
+
dataDir = join5(dataDir, "gir-1.0");
|
|
16459
16453
|
if (!girDirectories.includes(dataDir) && existsSync(dataDir)) {
|
|
16460
16454
|
girDirectories.push(dataDir);
|
|
16461
16455
|
}
|
|
@@ -16465,7 +16459,7 @@ function getDefaultGirDirectories() {
|
|
|
16465
16459
|
|
|
16466
16460
|
// src/config/config-writer.ts
|
|
16467
16461
|
var logger2 = new Logger(false, "ConfigWriter");
|
|
16468
|
-
var configFilePath =
|
|
16462
|
+
var configFilePath = join6(process.cwd(), defaults.configName);
|
|
16469
16463
|
function setConfigFilePath(path) {
|
|
16470
16464
|
configFilePath = path;
|
|
16471
16465
|
}
|
|
@@ -16879,12 +16873,12 @@ async function load(cliOptions) {
|
|
|
16879
16873
|
}
|
|
16880
16874
|
}
|
|
16881
16875
|
if (userConfig.outdir && !userConfig.outdir.startsWith("/")) {
|
|
16882
|
-
userConfig.outdir =
|
|
16876
|
+
userConfig.outdir = resolve4(userConfig.root, userConfig.outdir);
|
|
16883
16877
|
}
|
|
16884
16878
|
if (userConfig.girDirectories) {
|
|
16885
16879
|
userConfig.girDirectories = userConfig.girDirectories.map((dir) => {
|
|
16886
16880
|
if (!dir.startsWith("/")) {
|
|
16887
|
-
return
|
|
16881
|
+
return resolve4(userConfig.root, dir);
|
|
16888
16882
|
}
|
|
16889
16883
|
return dir;
|
|
16890
16884
|
});
|
|
@@ -16933,7 +16927,7 @@ var loadReportFile = (filePath) => {
|
|
|
16933
16927
|
throw new Error(`Report file not found: ${filePath}`);
|
|
16934
16928
|
}
|
|
16935
16929
|
try {
|
|
16936
|
-
const content =
|
|
16930
|
+
const content = readFileSync3(filePath, "utf-8");
|
|
16937
16931
|
const report = JSON.parse(content);
|
|
16938
16932
|
report.metadata.generatedAt = parseReportDate(report.metadata.generatedAt);
|
|
16939
16933
|
report.statistics.startTime = parseReportDate(report.statistics.startTime);
|
|
@@ -17160,7 +17154,7 @@ var analyze = {
|
|
|
17160
17154
|
|
|
17161
17155
|
// src/commands/copy.ts
|
|
17162
17156
|
import { copyFile, mkdir as mkdir2 } from "node:fs/promises";
|
|
17163
|
-
import { basename as basename2, join as
|
|
17157
|
+
import { basename as basename2, join as join8 } from "node:path";
|
|
17164
17158
|
|
|
17165
17159
|
// src/module-loader/dependency-resolver.ts
|
|
17166
17160
|
var DependencyResolver = class {
|
|
@@ -17238,7 +17232,7 @@ var DependencyResolver = class {
|
|
|
17238
17232
|
};
|
|
17239
17233
|
|
|
17240
17234
|
// src/module-loader/file-finder.ts
|
|
17241
|
-
import { basename, join as
|
|
17235
|
+
import { basename, join as join7 } from "node:path";
|
|
17242
17236
|
import { glob as glob2 } from "glob";
|
|
17243
17237
|
var FileFinder = class {
|
|
17244
17238
|
constructor(girDirectories, dependencyManager) {
|
|
@@ -17257,7 +17251,7 @@ var FileFinder = class {
|
|
|
17257
17251
|
continue;
|
|
17258
17252
|
}
|
|
17259
17253
|
const filename = `${globPackageNames[i]}.gir`;
|
|
17260
|
-
const pattern = this.girDirectories.map((girDirectory) =>
|
|
17254
|
+
const pattern = this.girDirectories.map((girDirectory) => join7(girDirectory, filename));
|
|
17261
17255
|
const ignoreGirs = ignore.map((girDirectory) => `${girDirectory}.gir`);
|
|
17262
17256
|
const files = await glob2(pattern, { ignore: ignoreGirs });
|
|
17263
17257
|
for (const file of files) {
|
|
@@ -17660,7 +17654,7 @@ var copyGirFile = async (config, depModule) => {
|
|
|
17660
17654
|
return;
|
|
17661
17655
|
}
|
|
17662
17656
|
const filename = basename2(depModule.path);
|
|
17663
|
-
const dest =
|
|
17657
|
+
const dest = join8(config.outdir, filename);
|
|
17664
17658
|
if (depModule.path === dest) {
|
|
17665
17659
|
logger3.yellow(`Skip ${depModule.path}`);
|
|
17666
17660
|
return;
|
|
@@ -17921,7 +17915,7 @@ var JsonDefinitionGenerator = class _JsonDefinitionGenerator {
|
|
|
17921
17915
|
};
|
|
17922
17916
|
|
|
17923
17917
|
// ../generator-typescript/src/template-processor.ts
|
|
17924
|
-
import { dirname as dirname6, join as
|
|
17918
|
+
import { dirname as dirname6, join as join9, relative } from "node:path";
|
|
17925
17919
|
var TemplateProcessor = class extends TemplateEngine {
|
|
17926
17920
|
data;
|
|
17927
17921
|
packageName;
|
|
@@ -17951,7 +17945,7 @@ var TemplateProcessor = class extends TemplateEngine {
|
|
|
17951
17945
|
dep,
|
|
17952
17946
|
deps,
|
|
17953
17947
|
typeDir,
|
|
17954
|
-
join:
|
|
17948
|
+
join: join9,
|
|
17955
17949
|
dirname: dirname6,
|
|
17956
17950
|
...this.config,
|
|
17957
17951
|
packageName: this.packageName
|
|
@@ -18022,10 +18016,10 @@ ${append}`;
|
|
|
18022
18016
|
const rendered = await this.loadAll(templateDirname, fileExtension, ejsOptions, overrideTemplateData);
|
|
18023
18017
|
const result = {};
|
|
18024
18018
|
for (const filename of Object.keys(rendered)) {
|
|
18025
|
-
const destPath =
|
|
18019
|
+
const destPath = join9(baseOutputPath, outputDirname, filename);
|
|
18026
18020
|
result[destPath] = `${rendered[filename]}
|
|
18027
18021
|
${append}`;
|
|
18028
|
-
await this.write(result[destPath], baseOutputPath,
|
|
18022
|
+
await this.write(result[destPath], baseOutputPath, join9(outputDirname, filename));
|
|
18029
18023
|
}
|
|
18030
18024
|
return result;
|
|
18031
18025
|
}
|
|
@@ -18034,8 +18028,8 @@ ${append}`;
|
|
|
18034
18028
|
* This is TypeScript-specific logic for handling package.json mode
|
|
18035
18029
|
*/
|
|
18036
18030
|
getOutputPath(baseOutputPath, outputFilename) {
|
|
18037
|
-
const filePath = this.config.package ?
|
|
18038
|
-
const outputPath =
|
|
18031
|
+
const filePath = this.config.package ? join9(this.data?.importName || this.packageName, outputFilename) : outputFilename;
|
|
18032
|
+
const outputPath = join9(baseOutputPath, filePath);
|
|
18039
18033
|
return outputPath;
|
|
18040
18034
|
}
|
|
18041
18035
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-for-gir/cli",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.32",
|
|
4
4
|
"description": "TypeScript type definition generator for GObject introspection GIR files",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"module": "src/index.ts",
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
".": "./src/index.ts"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@gi.ts/parser": "^4.0.0-beta.
|
|
57
|
-
"@ts-for-gir/generator-base": "^4.0.0-beta.
|
|
58
|
-
"@ts-for-gir/generator-html-doc": "^4.0.0-beta.
|
|
59
|
-
"@ts-for-gir/generator-json": "^4.0.0-beta.
|
|
60
|
-
"@ts-for-gir/generator-typescript": "^4.0.0-beta.
|
|
61
|
-
"@ts-for-gir/lib": "^4.0.0-beta.
|
|
62
|
-
"@ts-for-gir/reporter": "^4.0.0-beta.
|
|
56
|
+
"@gi.ts/parser": "^4.0.0-beta.32",
|
|
57
|
+
"@ts-for-gir/generator-base": "^4.0.0-beta.32",
|
|
58
|
+
"@ts-for-gir/generator-html-doc": "^4.0.0-beta.32",
|
|
59
|
+
"@ts-for-gir/generator-json": "^4.0.0-beta.32",
|
|
60
|
+
"@ts-for-gir/generator-typescript": "^4.0.0-beta.32",
|
|
61
|
+
"@ts-for-gir/lib": "^4.0.0-beta.32",
|
|
62
|
+
"@ts-for-gir/reporter": "^4.0.0-beta.32",
|
|
63
63
|
"@types/ejs": "^3.1.5",
|
|
64
64
|
"@types/inquirer": "^9.0.9",
|
|
65
65
|
"@types/node": "^24.2.1",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@inquirer/prompts": "^7.8.2",
|
|
73
|
-
"@ts-for-gir/templates": "^4.0.0-beta.
|
|
73
|
+
"@ts-for-gir/templates": "^4.0.0-beta.32",
|
|
74
74
|
"colorette": "^2.0.20",
|
|
75
75
|
"cosmiconfig": "^9.0.0",
|
|
76
76
|
"ejs": "^3.1.10",
|