@ts-for-gir/cli 4.0.0-beta.30 → 4.0.0-beta.31

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 (2) hide show
  1. package/bin/ts-for-gir +56 -56
  2. 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 join10(array, separator) {
3336
+ function join8(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 = join10;
5255
+ lodash2.join = join8;
5256
5256
  lodash2.kebabCase = kebabCase;
5257
5257
  lodash2.last = last;
5258
5258
  lodash2.lastIndexOf = lastIndexOf;
@@ -5516,34 +5516,34 @@ import { blue, gray, green, red, yellow, yellowBright } from "colorette";
5516
5516
  // ../reporter/src/constants.ts
5517
5517
  import { readFileSync } from "node:fs";
5518
5518
  import { createRequire } from "node:module";
5519
- import { dirname, join } from "node:path";
5519
+ import { dirname, resolve } from "node:path";
5520
5520
  var require2 = createRequire(import.meta.url);
5521
- function resolveWorkspacePackageJson() {
5521
+ function resolvePackageJson() {
5522
5522
  try {
5523
- return require2.resolve("../../../package.json");
5523
+ return require2.resolve("@ts-for-gir/reporter/package.json");
5524
5524
  } catch {
5525
5525
  try {
5526
- const currentPackageJson = require2.resolve("@ts-for-gir/reporter/package.json");
5527
- return join(dirname(dirname(currentPackageJson)), "package.json");
5526
+ const currentModule = require2.resolve("@ts-for-gir/reporter");
5527
+ return resolve(dirname(currentModule), "..", "package.json");
5528
5528
  } catch {
5529
- throw new Error("Unable to resolve workspace package.json path");
5529
+ throw new Error("Unable to resolve package.json path");
5530
5530
  }
5531
5531
  }
5532
5532
  }
5533
- function readWorkspacePackage() {
5533
+ function readPackage() {
5534
5534
  try {
5535
- const packagePath = resolveWorkspacePackageJson();
5535
+ const packagePath = resolvePackageJson();
5536
5536
  const content = readFileSync(packagePath, "utf-8");
5537
5537
  return JSON.parse(content);
5538
5538
  } catch (error) {
5539
5539
  const message = error instanceof Error ? error.message : "Unknown error";
5540
- throw new Error(`Failed to read workspace package.json: ${message}`);
5540
+ throw new Error(`Failed to read package.json: ${message}`);
5541
5541
  }
5542
5542
  }
5543
- var WORKSPACE_PACKAGE = readWorkspacePackage();
5544
- var REPORTER_VERSION = WORKSPACE_PACKAGE.version;
5545
- var PACKAGE_NAME = WORKSPACE_PACKAGE.name;
5546
- var PACKAGE_DESCRIPTION = WORKSPACE_PACKAGE.description;
5543
+ var PACKAGE = readPackage();
5544
+ var PACKAGE_VERSION = PACKAGE.version;
5545
+ var PACKAGE_NAME = PACKAGE.name;
5546
+ var PACKAGE_DESCRIPTION = PACKAGE.description;
5547
5547
 
5548
5548
  // ../reporter/src/types/problem.ts
5549
5549
  var ProblemSeverity = /* @__PURE__ */ ((ProblemSeverity2) => {
@@ -6044,7 +6044,7 @@ var ConsoleReporter = class _ConsoleReporter extends ReporterBase {
6044
6044
  }
6045
6045
  return {
6046
6046
  metadata: {
6047
- version: REPORTER_VERSION,
6047
+ version: PACKAGE_VERSION,
6048
6048
  generatedAt: /* @__PURE__ */ new Date()
6049
6049
  },
6050
6050
  statistics,
@@ -6184,7 +6184,7 @@ ${"=".repeat(50)}`);
6184
6184
 
6185
6185
  // ../reporter/src/reporter-service.ts
6186
6186
  import { writeFile as writeFile2 } from "node:fs/promises";
6187
- import { resolve } from "node:path";
6187
+ import { resolve as resolve2 } from "node:path";
6188
6188
  import { blue as blue2, green as green2, red as red2, yellow as yellow2 } from "colorette";
6189
6189
  var ReporterService = class _ReporterService {
6190
6190
  static instance = null;
@@ -6428,7 +6428,7 @@ var ReporterService = class _ReporterService {
6428
6428
  }
6429
6429
  return {
6430
6430
  metadata: {
6431
- version: REPORTER_VERSION,
6431
+ version: PACKAGE_VERSION,
6432
6432
  generatedAt: /* @__PURE__ */ new Date()
6433
6433
  },
6434
6434
  statistics,
@@ -6451,7 +6451,7 @@ var ReporterService = class _ReporterService {
6451
6451
  const report = this.generateComprehensiveReport();
6452
6452
  const filePath = outputPath || this.config.outputPath;
6453
6453
  try {
6454
- const fullPath = resolve(process.cwd(), filePath);
6454
+ const fullPath = resolve2(process.cwd(), filePath);
6455
6455
  await writeFile2(fullPath, JSON.stringify(report, null, 2), "utf-8");
6456
6456
  console.log(`\u{1F4CA} Comprehensive report saved to: ${fullPath}`);
6457
6457
  } catch (error) {
@@ -6535,37 +6535,37 @@ ${"=".repeat(60)}`);
6535
6535
 
6536
6536
  // ../lib/src/constants.ts
6537
6537
  import { createRequire as createRequire2 } from "node:module";
6538
- import { dirname as dirname2, join as join2 } from "node:path";
6538
+ import { dirname as dirname2, resolve as resolve3 } from "node:path";
6539
6539
  var require3 = createRequire2(import.meta.url);
6540
6540
  var NEW_LINE_REG_EXP = /[\n\r]+/g;
6541
- function resolveWorkspacePackageJson2() {
6541
+ function resolvePackageJson2() {
6542
6542
  try {
6543
- return require3.resolve("../../../package.json");
6543
+ return require3.resolve("@ts-for-gir/lib/package.json");
6544
6544
  } catch {
6545
6545
  try {
6546
- const currentPackageJson = require3.resolve("@ts-for-gir/lib/package.json");
6547
- return join2(dirname2(dirname2(currentPackageJson)), "package.json");
6546
+ const currentModule = require3.resolve("@ts-for-gir/lib");
6547
+ return resolve3(dirname2(currentModule), "..", "package.json");
6548
6548
  } catch {
6549
- throw new Error("Unable to resolve workspace package.json path");
6549
+ throw new Error("Unable to resolve package.json path");
6550
6550
  }
6551
6551
  }
6552
6552
  }
6553
- function readWorkspacePackageSync() {
6553
+ function readPackageSync() {
6554
6554
  try {
6555
- const packagePath = resolveWorkspacePackageJson2();
6555
+ const packagePath = resolvePackageJson2();
6556
6556
  const { readFileSync: readFileSync3 } = require3("node:fs");
6557
6557
  const content = readFileSync3(packagePath, "utf-8");
6558
6558
  return JSON.parse(content);
6559
6559
  } catch (error) {
6560
6560
  const message = error instanceof Error ? error.message : "Unknown error";
6561
- throw new Error(`Failed to read workspace package.json: ${message}`);
6561
+ throw new Error(`Failed to read package.json: ${message}`);
6562
6562
  }
6563
6563
  }
6564
- var PACKAGE = readWorkspacePackageSync();
6564
+ var PACKAGE2 = readPackageSync();
6565
6565
  var APP_NAME = "ts-for-gir";
6566
6566
  var APP_USAGE = "TypeScript type definition generator for GObject introspection GIR files";
6567
6567
  var APP_SOURCE = "https://github.com/gjsify/ts-for-gir";
6568
- var APP_VERSION = PACKAGE.version;
6568
+ var APP_VERSION = PACKAGE2.version;
6569
6569
  var PACKAGE_DESC = (packageName, libraryVersion) => {
6570
6570
  if (libraryVersion) {
6571
6571
  return `GJS TypeScript type definitions for ${packageName}, generated from library version ${libraryVersion.toString()}`;
@@ -8175,7 +8175,7 @@ var Logger = class _Logger {
8175
8175
  // ../lib/src/utils/files.ts
8176
8176
  import { constants } from "node:fs";
8177
8177
  import { access, readFile } from "node:fs/promises";
8178
- import { join as join3 } from "node:path";
8178
+ import { join } from "node:path";
8179
8179
  import { glob } from "glob";
8180
8180
  var fileExists = async (filePath) => {
8181
8181
  try {
@@ -8187,7 +8187,7 @@ var fileExists = async (filePath) => {
8187
8187
  };
8188
8188
  var findFilesInDirs = async (dirs, filename) => {
8189
8189
  const filesInfo = [];
8190
- const pattern = dirs.map((dir) => join3(dir, filename));
8190
+ const pattern = dirs.map((dir) => join(dir, filename));
8191
8191
  const _files = await glob(pattern);
8192
8192
  const files = [...new Set(_files)];
8193
8193
  for (const filePath of files) {
@@ -15946,7 +15946,7 @@ var GENERATING_TYPES_DONE = "Done.";
15946
15946
  // ../lib/src/templates/template-engine.ts
15947
15947
  import { mkdir, readdir, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
15948
15948
  import { createRequire as createRequire3 } from "node:module";
15949
- import { dirname as dirname3, extname, join as join4, resolve as resolve2 } from "node:path";
15949
+ import { dirname as dirname3, extname, join as join2, resolve as resolve4 } from "node:path";
15950
15950
  import ejs from "ejs";
15951
15951
  var require4 = createRequire3(import.meta.url);
15952
15952
  var TemplateEngine = class {
@@ -15962,9 +15962,9 @@ var TemplateEngine = class {
15962
15962
  */
15963
15963
  resolveTemplateDirectory() {
15964
15964
  try {
15965
- return join4(dirname3(require4.resolve("@ts-for-gir/templates/package.json")), "templates");
15965
+ return join2(dirname3(require4.resolve("@ts-for-gir/templates/package.json")), "templates");
15966
15966
  } catch (_error) {
15967
- return resolve2(process.cwd(), "../../templates/templates");
15967
+ return resolve4(process.cwd(), "../../templates/templates");
15968
15968
  }
15969
15969
  }
15970
15970
  /**
@@ -15986,7 +15986,7 @@ var TemplateEngine = class {
15986
15986
  * Checks if the template file or directory exists and returns the path if found
15987
15987
  */
15988
15988
  async exists(templateFilename) {
15989
- const fullTemplatePath = join4(this.templateDir, templateFilename);
15989
+ const fullTemplatePath = join2(this.templateDir, templateFilename);
15990
15990
  if (await fileExists(fullTemplatePath)) {
15991
15991
  return fullTemplatePath;
15992
15992
  }
@@ -16026,7 +16026,7 @@ var TemplateEngine = class {
16026
16026
  }
16027
16027
  const results = {};
16028
16028
  for (const file of files) {
16029
- const content = await readFile3(join4(path, file), "utf8");
16029
+ const content = await readFile3(join2(path, file), "utf8");
16030
16030
  results[file] = this.removeTypeScriptDirectives(content);
16031
16031
  }
16032
16032
  return results;
@@ -16397,10 +16397,10 @@ function mergeDescs(descs, comment, indentCount = 1) {
16397
16397
  }
16398
16398
 
16399
16399
  // ../lib/src/utils/path.ts
16400
- import { dirname as dirname4, resolve as resolve3 } from "node:path";
16400
+ import { dirname as dirname4, resolve as resolve5 } from "node:path";
16401
16401
  import { fileURLToPath } from "node:url";
16402
16402
  var __filename = fileURLToPath(import.meta.url);
16403
- var __dirname = resolve3(dirname4(__filename), "../..");
16403
+ var __dirname = resolve5(dirname4(__filename), "../..");
16404
16404
 
16405
16405
  // src/start.ts
16406
16406
  import yargs from "yargs";
@@ -16410,16 +16410,16 @@ import { hideBin } from "yargs/helpers";
16410
16410
  import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync } from "node:fs";
16411
16411
 
16412
16412
  // src/config/config-loader.ts
16413
- import { dirname as dirname5, resolve as resolve4 } from "node:path";
16413
+ import { dirname as dirname5, resolve as resolve6 } from "node:path";
16414
16414
  import { cosmiconfig } from "cosmiconfig";
16415
16415
 
16416
16416
  // src/config/config-writer.ts
16417
16417
  import { writeFile as writeFile4 } from "node:fs/promises";
16418
- import { extname as extname2, join as join6 } from "node:path";
16418
+ import { extname as extname2, join as join4 } from "node:path";
16419
16419
 
16420
16420
  // src/config/defaults.ts
16421
16421
  import { existsSync } from "node:fs";
16422
- import { join as join5 } from "node:path";
16422
+ import { join as join3 } from "node:path";
16423
16423
  var defaults = {
16424
16424
  print: false,
16425
16425
  configName: ".ts-for-girrc.js",
@@ -16455,7 +16455,7 @@ function getDefaultGirDirectories() {
16455
16455
  ];
16456
16456
  const dataDirs = process.env.XDG_DATA_DIRS?.split(":") || [];
16457
16457
  for (let dataDir of dataDirs) {
16458
- dataDir = join5(dataDir, "gir-1.0");
16458
+ dataDir = join3(dataDir, "gir-1.0");
16459
16459
  if (!girDirectories.includes(dataDir) && existsSync(dataDir)) {
16460
16460
  girDirectories.push(dataDir);
16461
16461
  }
@@ -16465,7 +16465,7 @@ function getDefaultGirDirectories() {
16465
16465
 
16466
16466
  // src/config/config-writer.ts
16467
16467
  var logger2 = new Logger(false, "ConfigWriter");
16468
- var configFilePath = join6(process.cwd(), defaults.configName);
16468
+ var configFilePath = join4(process.cwd(), defaults.configName);
16469
16469
  function setConfigFilePath(path) {
16470
16470
  configFilePath = path;
16471
16471
  }
@@ -16879,12 +16879,12 @@ async function load(cliOptions) {
16879
16879
  }
16880
16880
  }
16881
16881
  if (userConfig.outdir && !userConfig.outdir.startsWith("/")) {
16882
- userConfig.outdir = resolve4(userConfig.root, userConfig.outdir);
16882
+ userConfig.outdir = resolve6(userConfig.root, userConfig.outdir);
16883
16883
  }
16884
16884
  if (userConfig.girDirectories) {
16885
16885
  userConfig.girDirectories = userConfig.girDirectories.map((dir) => {
16886
16886
  if (!dir.startsWith("/")) {
16887
- return resolve4(userConfig.root, dir);
16887
+ return resolve6(userConfig.root, dir);
16888
16888
  }
16889
16889
  return dir;
16890
16890
  });
@@ -17160,7 +17160,7 @@ var analyze = {
17160
17160
 
17161
17161
  // src/commands/copy.ts
17162
17162
  import { copyFile, mkdir as mkdir2 } from "node:fs/promises";
17163
- import { basename as basename2, join as join8 } from "node:path";
17163
+ import { basename as basename2, join as join6 } from "node:path";
17164
17164
 
17165
17165
  // src/module-loader/dependency-resolver.ts
17166
17166
  var DependencyResolver = class {
@@ -17238,7 +17238,7 @@ var DependencyResolver = class {
17238
17238
  };
17239
17239
 
17240
17240
  // src/module-loader/file-finder.ts
17241
- import { basename, join as join7 } from "node:path";
17241
+ import { basename, join as join5 } from "node:path";
17242
17242
  import { glob as glob2 } from "glob";
17243
17243
  var FileFinder = class {
17244
17244
  constructor(girDirectories, dependencyManager) {
@@ -17257,7 +17257,7 @@ var FileFinder = class {
17257
17257
  continue;
17258
17258
  }
17259
17259
  const filename = `${globPackageNames[i]}.gir`;
17260
- const pattern = this.girDirectories.map((girDirectory) => join7(girDirectory, filename));
17260
+ const pattern = this.girDirectories.map((girDirectory) => join5(girDirectory, filename));
17261
17261
  const ignoreGirs = ignore.map((girDirectory) => `${girDirectory}.gir`);
17262
17262
  const files = await glob2(pattern, { ignore: ignoreGirs });
17263
17263
  for (const file of files) {
@@ -17660,7 +17660,7 @@ var copyGirFile = async (config, depModule) => {
17660
17660
  return;
17661
17661
  }
17662
17662
  const filename = basename2(depModule.path);
17663
- const dest = join8(config.outdir, filename);
17663
+ const dest = join6(config.outdir, filename);
17664
17664
  if (depModule.path === dest) {
17665
17665
  logger3.yellow(`Skip ${depModule.path}`);
17666
17666
  return;
@@ -17921,7 +17921,7 @@ var JsonDefinitionGenerator = class _JsonDefinitionGenerator {
17921
17921
  };
17922
17922
 
17923
17923
  // ../generator-typescript/src/template-processor.ts
17924
- import { dirname as dirname6, join as join9, relative } from "node:path";
17924
+ import { dirname as dirname6, join as join7, relative } from "node:path";
17925
17925
  var TemplateProcessor = class extends TemplateEngine {
17926
17926
  data;
17927
17927
  packageName;
@@ -17951,7 +17951,7 @@ var TemplateProcessor = class extends TemplateEngine {
17951
17951
  dep,
17952
17952
  deps,
17953
17953
  typeDir,
17954
- join: join9,
17954
+ join: join7,
17955
17955
  dirname: dirname6,
17956
17956
  ...this.config,
17957
17957
  packageName: this.packageName
@@ -18022,10 +18022,10 @@ ${append}`;
18022
18022
  const rendered = await this.loadAll(templateDirname, fileExtension, ejsOptions, overrideTemplateData);
18023
18023
  const result = {};
18024
18024
  for (const filename of Object.keys(rendered)) {
18025
- const destPath = join9(baseOutputPath, outputDirname, filename);
18025
+ const destPath = join7(baseOutputPath, outputDirname, filename);
18026
18026
  result[destPath] = `${rendered[filename]}
18027
18027
  ${append}`;
18028
- await this.write(result[destPath], baseOutputPath, join9(outputDirname, filename));
18028
+ await this.write(result[destPath], baseOutputPath, join7(outputDirname, filename));
18029
18029
  }
18030
18030
  return result;
18031
18031
  }
@@ -18034,8 +18034,8 @@ ${append}`;
18034
18034
  * This is TypeScript-specific logic for handling package.json mode
18035
18035
  */
18036
18036
  getOutputPath(baseOutputPath, outputFilename) {
18037
- const filePath = this.config.package ? join9(this.data?.importName || this.packageName, outputFilename) : outputFilename;
18038
- const outputPath = join9(baseOutputPath, filePath);
18037
+ const filePath = this.config.package ? join7(this.data?.importName || this.packageName, outputFilename) : outputFilename;
18038
+ const outputPath = join7(baseOutputPath, filePath);
18039
18039
  return outputPath;
18040
18040
  }
18041
18041
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-for-gir/cli",
3
- "version": "4.0.0-beta.30",
3
+ "version": "4.0.0-beta.31",
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.30",
57
- "@ts-for-gir/generator-base": "^4.0.0-beta.30",
58
- "@ts-for-gir/generator-html-doc": "^4.0.0-beta.30",
59
- "@ts-for-gir/generator-json": "^4.0.0-beta.30",
60
- "@ts-for-gir/generator-typescript": "^4.0.0-beta.30",
61
- "@ts-for-gir/lib": "^4.0.0-beta.30",
62
- "@ts-for-gir/reporter": "^4.0.0-beta.30",
56
+ "@gi.ts/parser": "^4.0.0-beta.31",
57
+ "@ts-for-gir/generator-base": "^4.0.0-beta.31",
58
+ "@ts-for-gir/generator-html-doc": "^4.0.0-beta.31",
59
+ "@ts-for-gir/generator-json": "^4.0.0-beta.31",
60
+ "@ts-for-gir/generator-typescript": "^4.0.0-beta.31",
61
+ "@ts-for-gir/lib": "^4.0.0-beta.31",
62
+ "@ts-for-gir/reporter": "^4.0.0-beta.31",
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.30",
73
+ "@ts-for-gir/templates": "^4.0.0-beta.31",
74
74
  "colorette": "^2.0.20",
75
75
  "cosmiconfig": "^9.0.0",
76
76
  "ejs": "^3.1.10",