@diplodoc/cli 4.22.0-alpha-1 → 4.22.0-alpha-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/build/index.js CHANGED
@@ -261690,7 +261690,7 @@ var parser3 = import_yargs.default.command(build).option("config", {
261690
261690
  default: false,
261691
261691
  describe: "Run in quiet mode. Don't write logs to stdout",
261692
261692
  type: "boolean"
261693
- }).group(["config", "strict", "quiet", "help", "version"], "Common options:").version(true ? "4.22.0-alpha-1" : "").help();
261693
+ }).group(["config", "strict", "quiet", "help", "version"], "Common options:").version(true ? "4.22.0-alpha-2" : "").help();
261694
261694
  var Build = class extends BaseProgram(command, {
261695
261695
  config: {
261696
261696
  // scope: 'build',
@@ -265590,7 +265590,7 @@ function bytes(texts) {
265590
265590
  }
265591
265591
 
265592
265592
  // src/commands/translate/providers/yandex/provider.ts
265593
- var REQUESTS_LIMIT = 20;
265593
+ var REQUESTS_LIMIT = 15;
265594
265594
  var BYTES_LIMIT = 1e4;
265595
265595
  var RETRY_LIMIT = 3;
265596
265596
  var TranslateLogger = class extends Logger {
@@ -265622,7 +265622,7 @@ var Provider = class {
265622
265622
  };
265623
265623
  const cache2 = /* @__PURE__ */ new Map();
265624
265624
  const request2 = requester(translatorParams, cache2);
265625
- const split = splitter(request2, cache2);
265625
+ const split = splitter(request2, cache2, this.logger);
265626
265626
  const translate = translator(translatorParams, split);
265627
265627
  yield (0, import_async5.eachLimit)(
265628
265628
  files2,
@@ -265734,14 +265734,19 @@ function requester(params, cache2) {
265734
265734
  } catch (error) {
265735
265735
  if (error instanceof AxiosError2) {
265736
265736
  const { response: response2 } = error;
265737
- const { status, statusText, data } = response2;
265738
- switch (true) {
265739
- case LimitExceed.is(data.message):
265740
- throw new LimitExceed(data.message);
265741
- case AuthError.is(data.message):
265742
- throw new AuthError(data.message);
265743
- default:
265744
- throw new RequestError(status, statusText, data);
265737
+ if (response2) {
265738
+ const { status, statusText, data } = response2;
265739
+ switch (true) {
265740
+ case LimitExceed.is(data.message):
265741
+ throw new LimitExceed(data.message);
265742
+ case AuthError.is(data.message):
265743
+ throw new AuthError(data.message);
265744
+ default:
265745
+ throw new RequestError(status, statusText, data);
265746
+ }
265747
+ } else {
265748
+ console.error(error.code);
265749
+ console.error(error.cause);
265745
265750
  }
265746
265751
  }
265747
265752
  throw new RequestError(0, error.message, { fatal: true });
@@ -265797,7 +265802,7 @@ function translator(params, split) {
265797
265802
  yield dumpFile(outputPath, composed);
265798
265803
  });
265799
265804
  }
265800
- function splitter(request2, cache2) {
265805
+ function splitter(request2, cache2, logger2) {
265801
265806
  return function(path2, texts) {
265802
265807
  return __async(this, null, function* () {
265803
265808
  const promises = [];
@@ -265811,6 +265816,7 @@ function splitter(request2, cache2) {
265811
265816
  };
265812
265817
  for (const text of texts) {
265813
265818
  if (text.length >= BYTES_LIMIT) {
265819
+ logger2.warn(path2, "Skip document part for translation. Part is too big.");
265814
265820
  promises.push(Promise.resolve(text));
265815
265821
  } else {
265816
265822
  const defer = cache2.get(text) || new Defer();
@@ -266091,7 +266097,7 @@ var Program = class extends BaseProgram("Program", {
266091
266097
  constructor() {
266092
266098
  super(...arguments);
266093
266099
  this.command = new Command2(NAME).helpOption(true).allowUnknownOption(false).version(
266094
- true ? "4.22.0-alpha-1" : "",
266100
+ true ? "4.22.0-alpha-2" : "",
266095
266101
  "--version",
266096
266102
  "Output the version number"
266097
266103
  ).usage(USAGE);