@diplodoc/cli 4.7.0 → 4.8.0

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
@@ -35,9 +35,6 @@ var __objRest = (source, exclude) => {
35
35
  }
36
36
  return target;
37
37
  };
38
- var __commonJS = (cb, mod) => function __require() {
39
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
40
- };
41
38
  var __export = (target, all) => {
42
39
  for (var name4 in all)
43
40
  __defProp(target, name4, { get: all[name4], enumerable: true });
@@ -59,7 +56,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
59
56
  mod
60
57
  ));
61
58
  var __async = (__this, __arguments, generator) => {
62
- return new Promise((resolve17, reject) => {
59
+ return new Promise((resolve18, reject) => {
63
60
  var fulfilled = (value) => {
64
61
  try {
65
62
  step(generator.next(value));
@@ -74,43 +71,11 @@ var __async = (__this, __arguments, generator) => {
74
71
  reject(e);
75
72
  }
76
73
  };
77
- var step = (x) => x.done ? resolve17(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
74
+ var step = (x) => x.done ? resolve18(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
78
75
  step((generator = generator.apply(__this, __arguments)).next());
79
76
  });
80
77
  };
81
78
 
82
- // scripts/client.js
83
- var require_client = __commonJS({
84
- "scripts/client.js"(exports, module2) {
85
- "use strict";
86
- var path = require("path");
87
- var CLIENT_PATH = path.dirname(require.resolve("@diplodoc/client"));
88
- var BUILD_PATH = path.resolve(__dirname, "..", "build");
89
- var BUNDLE_JS_FILENAME = "app.client.js";
90
- var BUNDLE_CSS_FILENAME = "app.client.css";
91
- var src = (target) => path.resolve(CLIENT_PATH, target);
92
- var dst = (target) => path.resolve(BUILD_PATH, target);
93
- module2.exports = {
94
- dst: {
95
- js: dst(BUNDLE_JS_FILENAME),
96
- css: dst(BUNDLE_CSS_FILENAME)
97
- },
98
- src: {
99
- js: src(BUNDLE_JS_FILENAME),
100
- css: src(BUNDLE_CSS_FILENAME)
101
- },
102
- bundle: {
103
- js(bundlePath) {
104
- return path.join(bundlePath, BUNDLE_JS_FILENAME);
105
- },
106
- css(bundlePath) {
107
- return path.join(bundlePath, BUNDLE_CSS_FILENAME);
108
- }
109
- }
110
- };
111
- }
112
- });
113
-
114
79
  // src/index.ts
115
80
  var import_yargs = __toESM(require("yargs"));
116
81
  var import_helpers = require("yargs/helpers");
@@ -139,10 +104,12 @@ var term = require("@diplodoc/transform/lib/plugins/term");
139
104
  var blockAnchor = require("@diplodoc/transform/lib/plugins/block-anchor");
140
105
  var changelog = require("@diplodoc/transform/lib/plugins/changelog");
141
106
  var mermaid = require("@diplodoc/mermaid-extension");
107
+ var latex = require("@diplodoc/latex-extension");
142
108
  var openapi = require("@diplodoc/openapi-extension");
143
109
  includes.collect = require("@diplodoc/transform/lib/plugins/includes/collect");
144
110
  images.collect = require("@diplodoc/transform/lib/plugins/images/collect");
145
111
  changelog.collect = require("@diplodoc/transform/lib/plugins/changelog/collect");
112
+ var ASSETS_FOLDER = (0, import_path.resolve)(__dirname, "../assets");
146
113
  var BUNDLE_FOLDER = "_bundle";
147
114
  var TMP_INPUT_FOLDER = ".tmp_input";
148
115
  var TMP_OUTPUT_FOLDER = ".tmp_output";
@@ -158,7 +125,6 @@ var ResourceType = /* @__PURE__ */ ((ResourceType2) => {
158
125
  ResourceType2["script"] = "script";
159
126
  return ResourceType2;
160
127
  })(ResourceType || {});
161
- var BUILD_FOLDER_PATH = (0, import_path.dirname)(require.resolve("@diplodoc/client"));
162
128
  var YFM_PLUGINS = [
163
129
  meta,
164
130
  deflist,
@@ -178,6 +144,7 @@ var YFM_PLUGINS = [
178
144
  term,
179
145
  openapi.transform(),
180
146
  mermaid.transform(),
147
+ latex.transform(),
181
148
  changelog,
182
149
  blockAnchor
183
150
  ];
@@ -320,10 +287,10 @@ function argvValidator(argv) {
320
287
  }
321
288
 
322
289
  // src/cmd/build/index.ts
323
- var import_path27 = require("path");
290
+ var import_path28 = require("path");
324
291
 
325
292
  // src/services/tocs.ts
326
- var import_path13 = require("path");
293
+ var import_path14 = require("path");
327
294
  var import_fs3 = require("fs");
328
295
  var import_js_yaml4 = require("js-yaml");
329
296
  var import_shelljs2 = __toESM(require("shelljs"));
@@ -371,6 +338,7 @@ var logger = {
371
338
  };
372
339
 
373
340
  // src/utils/markup.ts
341
+ var import_path4 = require("path");
374
342
  var import_process = require("process");
375
343
 
376
344
  // src/utils/singlePage.ts
@@ -378,7 +346,7 @@ var import_node_html_parser = require("node-html-parser");
378
346
  var import_path3 = require("path");
379
347
  var import_utilsFS = require("@diplodoc/transform/lib/utilsFS");
380
348
  var import_url = __toESM(require("url"));
381
- var import_lodash = __toESM(require("lodash"));
349
+ var import_escapeRegExp = __toESM(require("lodash/escapeRegExp"));
382
350
 
383
351
  // src/utils/url.ts
384
352
  function isExternalHref(href) {
@@ -387,6 +355,9 @@ function isExternalHref(href) {
387
355
 
388
356
  // src/utils/singlePage.ts
389
357
  var HEADERS_SELECTOR = "h1, h2, h3, h4, h5, h6";
358
+ function toUrl(path) {
359
+ return path.replace(new RegExp((0, import_escapeRegExp.default)(import_path3.sep), "g"), "/");
360
+ }
390
361
  function getNewNode(options) {
391
362
  const { rawTagName, innerHTML, attrEntries } = options;
392
363
  const nodeNew = (0, import_node_html_parser.parse)(`<html><${rawTagName}></${rawTagName}></html>`).querySelector(
@@ -441,7 +412,7 @@ function replaceLinks(rootEl, options) {
441
412
  preparedHref = getSinglePageAnchorId({ root, currentPath: resolvedPath, hash });
442
413
  }
443
414
  }
444
- node.setAttribute("href", preparedHref);
415
+ node.setAttribute("href", toUrl(preparedHref));
445
416
  });
446
417
  }
447
418
  function replaceImages(rootEl, options) {
@@ -454,7 +425,7 @@ function replaceImages(rootEl, options) {
454
425
  const resolvedPath = (0, import_path3.resolve)(root, path);
455
426
  const linkFullPath = (0, import_utilsFS.resolveRelativePath)(resolvedPath, href);
456
427
  const preparedHref = (0, import_path3.relative)(tocDir, linkFullPath);
457
- node.setAttribute("src", preparedHref);
428
+ node.setAttribute("src", toUrl(preparedHref));
458
429
  });
459
430
  }
460
431
  function prepareAnchorAttr(name4, value, pageId) {
@@ -470,7 +441,7 @@ function prepareAnchorAttr(name4, value, pageId) {
470
441
  function prepareAnchorAttrs(node, pageId) {
471
442
  for (const [name4, value] of Object.entries(node.attributes)) {
472
443
  const preparedValue = prepareAnchorAttr(name4, value, pageId);
473
- node.setAttribute(name4, preparedValue);
444
+ node.setAttribute(name4, toUrl(preparedValue));
474
445
  }
475
446
  }
476
447
  function addPagePrefixToAnchors(rootEl, options) {
@@ -515,7 +486,7 @@ function getSinglePageAnchorId(args) {
515
486
  if (pathname) {
516
487
  resultAnchor = (0, import_utilsFS.resolveRelativePath)(currentPath, pathname);
517
488
  }
518
- resultAnchor = resultAnchor.replace(root, "").replace(/\.(md|ya?ml|html)$/i, "").replace(new RegExp(import_lodash.default.escapeRegExp(import_path3.sep), "gi"), "_");
489
+ resultAnchor = resultAnchor.replace(root, "").replace(/\.(md|ya?ml|html)$/i, "").replace(new RegExp((0, import_escapeRegExp.default)(import_path3.sep), "gi"), "_");
519
490
  if (hash) {
520
491
  resultAnchor = resultAnchor + "_" + hash.slice(1);
521
492
  }
@@ -537,8 +508,9 @@ function preprocessPageHtmlForSinglePage(content, options) {
537
508
  }
538
509
 
539
510
  // src/utils/markup.ts
540
- var import_client = require("@diplodoc/client");
541
- var import_client2 = __toESM(require_client());
511
+ var import_ssr = require("@diplodoc/client/ssr");
512
+ var import_manifest = __toESM(require("@diplodoc/client/manifest"));
513
+ var dst = (bundlePath) => (target) => (0, import_path4.join)(bundlePath, target);
542
514
  function generateStaticMarkup(props, pathToBundle) {
543
515
  const { title: metaTitle, style, script } = props.data.meta || {};
544
516
  const { title: tocTitle } = props.data.toc;
@@ -550,7 +522,7 @@ function generateStaticMarkup(props, pathToBundle) {
550
522
  });
551
523
  const resources = getResources({ style, script });
552
524
  const { staticContent } = argv_default.getConfig();
553
- const html = staticContent ? (0, import_client.render)(props) : "";
525
+ const html = staticContent ? (0, import_ssr.render)(props) : "";
554
526
  return `
555
527
  <!DOCTYPE html>
556
528
  <html lang="${props.lang}">
@@ -564,7 +536,7 @@ function generateStaticMarkup(props, pathToBundle) {
564
536
  height: 100vh;
565
537
  }
566
538
  </style>
567
- <link type="text/css" rel="stylesheet" href="${import_client2.default.bundle.css(pathToBundle)}" />
539
+ ${import_manifest.default.css.map(dst(pathToBundle)).map((src) => `<link type="text/css" rel="stylesheet" href="${src}" />`).join("\n")}
568
540
  ${plugins_exports.getHeadContent()}
569
541
  ${resources}
570
542
  </head>
@@ -574,9 +546,9 @@ function generateStaticMarkup(props, pathToBundle) {
574
546
  window.STATIC_CONTENT = ${staticContent}
575
547
  window.__DATA__ = ${JSON.stringify(props)};
576
548
  </script>
577
- <script type="application/javascript" src="${import_client2.default.bundle.js(
578
- pathToBundle
579
- )}"></script>
549
+ ${import_manifest.default.js.map(dst(pathToBundle)).map(
550
+ (src) => `<script type="application/javascript" src="${src}"></script>`
551
+ ).join("\n")}
580
552
  </body>
581
553
  </html>
582
554
  `;
@@ -618,7 +590,7 @@ function getResources({ style, script }) {
618
590
  }
619
591
  var \u0441arriage = import_process.platform === "win32" /* WINDOWS */ ? "\r\n" : "\n";
620
592
  function joinSinglePageResults(singlePageResults2, root, tocDir) {
621
- const delimeter = `${\u0441arriage}${\u0441arriage}<hr class="yfm-page__delimeter">${\u0441arriage}${\u0441arriage}`;
593
+ const delimeter = `<hr class="yfm-page__delimeter">`;
622
594
  return singlePageResults2.filter(({ content }) => content).map(
623
595
  ({ content, path, title }) => preprocessPageHtmlForSinglePage(content, { root, path, tocDir, title })
624
596
  ).join(delimeter);
@@ -628,9 +600,9 @@ function replaceDoubleToSingleQuotes(str) {
628
600
  }
629
601
 
630
602
  // src/utils/path.ts
631
- var import_path4 = require("path");
603
+ var import_path5 = require("path");
632
604
  function addSlashPrefix(path) {
633
- const slashPrefix = path.startsWith(import_path4.sep) ? "" : import_path4.sep;
605
+ const slashPrefix = path.startsWith(import_path5.sep) ? "" : import_path5.sep;
634
606
  return `${slashPrefix}${path}`;
635
607
  }
636
608
  function convertBackSlashToSlash(path) {
@@ -641,7 +613,7 @@ function convertBackSlashToSlash(path) {
641
613
  }
642
614
 
643
615
  // src/utils/toc.ts
644
- var import_path5 = require("path");
616
+ var import_path6 = require("path");
645
617
 
646
618
  // src/services/utils.ts
647
619
  var import_evaluation = __toESM(require("@diplodoc/transform/lib/liquid/evaluation"));
@@ -767,14 +739,14 @@ function transformToc(toc, pathToFileDirectory) {
767
739
  navigationItemQueue.push(...navigationItem.items);
768
740
  }
769
741
  if (href && !isExternalHref(href)) {
770
- const pathToIndexDirectory = (0, import_path5.relative)(pathToFileDirectory, baseTocPath);
771
- const fileExtension = (0, import_path5.extname)(href);
772
- const filename = (0, import_path5.basename)(href, fileExtension);
773
- const transformedFilename = (0, import_path5.format)({
742
+ const pathToIndexDirectory = (0, import_path6.relative)(pathToFileDirectory, baseTocPath);
743
+ const fileExtension = (0, import_path6.extname)(href);
744
+ const filename = (0, import_path6.basename)(href, fileExtension);
745
+ const transformedFilename = (0, import_path6.format)({
774
746
  name: filename,
775
747
  ext: ".html"
776
748
  });
777
- navigationItem.href = (0, import_path5.join)(pathToIndexDirectory, (0, import_path5.dirname)(href), transformedFilename);
749
+ navigationItem.href = (0, import_path6.join)(pathToIndexDirectory, (0, import_path6.dirname)(href), transformedFilename);
778
750
  }
779
751
  }
780
752
  return localToc;
@@ -811,15 +783,15 @@ function transformTocForSinglePage(toc, options) {
811
783
  }
812
784
 
813
785
  // src/utils/presets.ts
814
- var import_path6 = require("path");
786
+ var import_path7 = require("path");
815
787
  function getVarsPerFile(filePath) {
816
788
  const { vars: argVars } = argv_default.getConfig();
817
- return __spreadValues(__spreadValues({}, preset_default.get((0, import_path6.dirname)(filePath))), argVars);
789
+ return __spreadValues(__spreadValues({}, preset_default.get((0, import_path7.dirname)(filePath))), argVars);
818
790
  }
819
791
  function getVarsPerRelativeFile(filePath) {
820
792
  const { input } = argv_default.getConfig();
821
- const root = (0, import_path6.resolve)(input);
822
- const relativeFilePath = (0, import_path6.relative)(root, filePath);
793
+ const root = (0, import_path7.resolve)(input);
794
+ const relativeFilePath = (0, import_path7.relative)(root, filePath);
823
795
  return getVarsPerFile(relativeFilePath);
824
796
  }
825
797
 
@@ -832,14 +804,14 @@ var glob = (pattern, options) => __async(void 0, null, function* () {
832
804
  });
833
805
 
834
806
  // src/utils/file.ts
835
- var import_path7 = require("path");
807
+ var import_path8 = require("path");
836
808
  var import_shelljs = __toESM(require("shelljs"));
837
809
  function copyFiles(inputFolderPath, outputFolderPath, files) {
838
810
  const dirs = /* @__PURE__ */ new Set();
839
811
  files.forEach((pathToAsset) => {
840
- const outputDir = (0, import_path7.resolve)(outputFolderPath, (0, import_path7.dirname)(pathToAsset));
841
- const from = (0, import_path7.resolve)(inputFolderPath, pathToAsset);
842
- const to = (0, import_path7.resolve)(outputFolderPath, pathToAsset);
812
+ const outputDir = (0, import_path8.resolve)(outputFolderPath, (0, import_path8.dirname)(pathToAsset));
813
+ const from = (0, import_path8.resolve)(inputFolderPath, pathToAsset);
814
+ const to = (0, import_path8.resolve)(outputFolderPath, pathToAsset);
843
815
  if (!dirs.has(outputDir)) {
844
816
  dirs.add(outputDir);
845
817
  import_shelljs.default.mkdir("-p", outputDir);
@@ -895,7 +867,7 @@ function getAuthorDetails(vcsConnector, author) {
895
867
 
896
868
  // src/services/contributors.ts
897
869
  var import_promises = require("fs/promises");
898
- var import_path8 = require("path");
870
+ var import_path9 = require("path");
899
871
  function getFileContributorsMetadata(fileData, vcsConnector) {
900
872
  return __async(this, null, function* () {
901
873
  const contributors = yield getFileContributorsString(fileData, vcsConnector);
@@ -965,8 +937,8 @@ function getRelativeIncludeFilePaths(fileData, includeContents) {
965
937
  const relativeIncludeFilePath = includeContent.match(REGEXP_INCLUDE_FILE_PATH);
966
938
  if (relativeIncludeFilePath && relativeIncludeFilePath.length !== 0) {
967
939
  const relativeIncludeFilePathWithoutHash = relativeIncludeFilePath[0].split("#");
968
- const includeFilePath = (0, import_path8.join)(
969
- (0, import_path8.dirname)(tmpInputFilePath),
940
+ const includeFilePath = (0, import_path9.join)(
941
+ (0, import_path9.dirname)(tmpInputFilePath),
970
942
  relativeIncludeFilePathWithoutHash[0]
971
943
  );
972
944
  relativeIncludeFilePaths.add(includeFilePath);
@@ -976,7 +948,7 @@ function getRelativeIncludeFilePaths(fileData, includeContents) {
976
948
  }
977
949
 
978
950
  // src/services/metadata.ts
979
- var import_path9 = require("path");
951
+ var import_path10 = require("path");
980
952
  function getContentWithUpdatedMetadata(fileContent, options, systemVars) {
981
953
  return __async(this, null, function* () {
982
954
  var _a;
@@ -1147,8 +1119,8 @@ function getSystemVarsMetadataString(systemVars) {
1147
1119
  }
1148
1120
  function getAssetsPublicPath(filePath) {
1149
1121
  const { input } = argv_default.getConfig();
1150
- const path = (0, import_path9.resolve)(input, filePath);
1151
- return (0, import_path9.relative)((0, import_path9.dirname)(path), (0, import_path9.resolve)(input));
1122
+ const path = (0, import_path10.resolve)(input, filePath);
1123
+ return (0, import_path10.relative)((0, import_path10.dirname)(path), (0, import_path10.resolve)(input));
1152
1124
  }
1153
1125
 
1154
1126
  // src/services/includers/index.ts
@@ -1158,8 +1130,8 @@ __export(includers_exports, {
1158
1130
  applyIncluders: () => applyIncluders,
1159
1131
  init: () => init
1160
1132
  });
1161
- var import_path12 = require("path");
1162
- var import_lodash3 = require("lodash");
1133
+ var import_path13 = require("path");
1134
+ var import_lodash2 = require("lodash");
1163
1135
 
1164
1136
  // src/services/includers/batteries/generic.ts
1165
1137
  var generic_exports = {};
@@ -1169,8 +1141,8 @@ __export(generic_exports, {
1169
1141
  name: () => name
1170
1142
  });
1171
1143
  var import_promises2 = require("fs/promises");
1172
- var import_path10 = require("path");
1173
- var import_lodash2 = require("lodash");
1144
+ var import_path11 = require("path");
1145
+ var import_lodash = require("lodash");
1174
1146
  var import_js_yaml3 = require("js-yaml");
1175
1147
  var GenericIncluderError = class extends Error {
1176
1148
  constructor(message, path) {
@@ -1197,8 +1169,8 @@ function includerFunction(params) {
1197
1169
  }
1198
1170
  try {
1199
1171
  const leadingPageName = (_b = leadingPage == null ? void 0 : leadingPage.name) != null ? _b : "Overview";
1200
- const tocDirPath = (0, import_path10.dirname)(tocPath);
1201
- const contentPath = index === 0 ? (0, import_path10.join)(writeBasePath, tocDirPath, input) : (0, import_path10.join)(readBasePath, tocDirPath, input);
1172
+ const tocDirPath = (0, import_path11.dirname)(tocPath);
1173
+ const contentPath = index === 0 ? (0, import_path11.join)(writeBasePath, tocDirPath, input) : (0, import_path11.join)(readBasePath, tocDirPath, input);
1202
1174
  let cache = {};
1203
1175
  let found = [];
1204
1176
  ({
@@ -1209,16 +1181,16 @@ function includerFunction(params) {
1209
1181
  nocase: true,
1210
1182
  cache
1211
1183
  }));
1212
- const writePath = (0, import_path10.join)(writeBasePath, tocDirPath, item.include.path);
1184
+ const writePath = (0, import_path11.join)(writeBasePath, tocDirPath, item.include.path);
1213
1185
  yield (0, import_promises2.mkdir)(writePath, { recursive: true });
1214
1186
  for (const filePath of found) {
1215
- const file = yield (0, import_promises2.readFile)((0, import_path10.join)(contentPath, filePath));
1216
- yield (0, import_promises2.mkdir)((0, import_path10.dirname)((0, import_path10.join)(writePath, filePath)), { recursive: true });
1217
- yield (0, import_promises2.writeFile)((0, import_path10.join)(writePath, filePath), file);
1187
+ const file = yield (0, import_promises2.readFile)((0, import_path11.join)(contentPath, filePath));
1188
+ yield (0, import_promises2.mkdir)((0, import_path11.dirname)((0, import_path11.join)(writePath, filePath)), { recursive: true });
1189
+ yield (0, import_promises2.writeFile)((0, import_path11.join)(writePath, filePath), file);
1218
1190
  }
1219
1191
  const graph = createGraphFromPaths(found);
1220
1192
  const toc = createToc(leadingPageName, item.include.path)(graph, []);
1221
- yield (0, import_promises2.writeFile)((0, import_path10.join)(writePath, "toc.yaml"), (0, import_js_yaml3.dump)(toc));
1193
+ yield (0, import_promises2.writeFile)((0, import_path11.join)(writePath, "toc.yaml"), (0, import_js_yaml3.dump)(toc));
1222
1194
  } catch (err) {
1223
1195
  throw new GenericIncluderError(err.toString(), tocPath);
1224
1196
  }
@@ -1235,7 +1207,7 @@ function createGraphFromPaths(paths) {
1235
1207
  continue;
1236
1208
  }
1237
1209
  const file = chunks.pop();
1238
- (0, import_lodash2.updateWith)(
1210
+ (0, import_lodash.updateWith)(
1239
1211
  graph,
1240
1212
  chunks,
1241
1213
  (old) => {
@@ -1250,8 +1222,8 @@ function createToc(leadingPageName, tocName) {
1250
1222
  return function createTocRec(graph, cursor) {
1251
1223
  var _a, _b;
1252
1224
  const handler6 = (file) => ({
1253
- name: (0, import_path10.parse)(file).name === "index" ? leadingPageName : file,
1254
- href: (0, import_path10.join)(...cursor, file)
1225
+ name: (0, import_path11.parse)(file).name === "index" ? leadingPageName : file,
1226
+ href: (0, import_path11.join)(...cursor, file)
1255
1227
  });
1256
1228
  const recurse = (key) => createTocRec(graph[key], [...cursor, key]);
1257
1229
  const current = {
@@ -1302,7 +1274,7 @@ __export(unarchive_exports, {
1302
1274
  name: () => name3
1303
1275
  });
1304
1276
  var import_fs2 = require("fs");
1305
- var import_path11 = require("path");
1277
+ var import_path12 = require("path");
1306
1278
  var import_tar_stream = require("tar-stream");
1307
1279
  var name3 = "unarchive";
1308
1280
  var UnarchiveIncluderError = class extends Error {
@@ -1325,8 +1297,8 @@ function pipeline(readPath, writeBasePath) {
1325
1297
  (0, import_fs2.mkdirSync)(writeBasePath, { recursive: true });
1326
1298
  extractor2.on("entry", (header, stream, next) => {
1327
1299
  const { type, name: name4 } = header;
1328
- const writePath = (0, import_path11.join)(writeBasePath, name4);
1329
- const writeDirPath = type === "directory" ? writePath : (0, import_path11.dirname)(writePath);
1300
+ const writePath = (0, import_path12.join)(writeBasePath, name4);
1301
+ const writeDirPath = type === "directory" ? writePath : (0, import_path12.dirname)(writePath);
1330
1302
  (0, import_fs2.mkdirSync)(writeDirPath, { recursive: true });
1331
1303
  if (type !== "directory") {
1332
1304
  const writer3 = (0, import_fs2.createWriteStream)(writePath, { flags: "w" });
@@ -1357,8 +1329,8 @@ function includerFunction3(params) {
1357
1329
  if (!(input == null ? void 0 : input.length) || !(output == null ? void 0 : output.length)) {
1358
1330
  throw new UnarchiveIncluderError("provide includer with input parameter", tocPath);
1359
1331
  }
1360
- const contentPath = index === 0 ? (0, import_path11.join)(writeBasePath, input) : (0, import_path11.join)(readBasePath, input);
1361
- const writePath = (0, import_path11.join)(writeBasePath, output);
1332
+ const contentPath = index === 0 ? (0, import_path12.join)(writeBasePath, input) : (0, import_path12.join)(readBasePath, input);
1333
+ const writePath = (0, import_path12.join)(writeBasePath, output);
1362
1334
  try {
1363
1335
  yield pipeline(contentPath, writePath);
1364
1336
  } catch (err) {
@@ -1415,7 +1387,7 @@ function applyIncluders(path, item, vars) {
1415
1387
  const passedParams = __spreadValues({}, rest);
1416
1388
  yield applyIncluder({ path, item, includer, passedParams, index, vars });
1417
1389
  }
1418
- item.include.path = (0, import_path12.join)(item.include.path, "toc.yaml");
1390
+ item.include.path = (0, import_path13.join)(item.include.path, "toc.yaml");
1419
1391
  index++;
1420
1392
  });
1421
1393
  }
@@ -1433,7 +1405,7 @@ function includersValid(includers) {
1433
1405
  return { status: true };
1434
1406
  }
1435
1407
  function includerValid(includer) {
1436
- if ((0, import_lodash3.isObject)(includer)) {
1408
+ if ((0, import_lodash2.isObject)(includer)) {
1437
1409
  if (typeof includer.name !== "string") {
1438
1410
  return {
1439
1411
  status: false,
@@ -1487,8 +1459,8 @@ function add(path) {
1487
1459
  ignoreStage,
1488
1460
  vars
1489
1461
  } = argv_default.getConfig();
1490
- const pathToDir = (0, import_path13.dirname)(path);
1491
- const content = (0, import_fs3.readFileSync)((0, import_path13.resolve)(inputFolderPath, path), "utf8");
1462
+ const pathToDir = (0, import_path14.dirname)(path);
1463
+ const content = (0, import_fs3.readFileSync)((0, import_path14.resolve)(inputFolderPath, path), "utf8");
1492
1464
  const parsedToc = (0, import_js_yaml4.load)(content);
1493
1465
  if (parsedToc.stage === ignoreStage) {
1494
1466
  return;
@@ -1505,16 +1477,16 @@ function add(path) {
1505
1477
  parsedToc.items = yield processTocItems(
1506
1478
  path,
1507
1479
  parsedToc.items,
1508
- (0, import_path13.join)(inputFolderPath, pathToDir),
1509
- (0, import_path13.resolve)(inputFolderPath),
1480
+ (0, import_path14.join)(inputFolderPath, pathToDir),
1481
+ (0, import_path14.resolve)(inputFolderPath),
1510
1482
  combinedVars
1511
1483
  );
1512
1484
  storage.set(path, parsedToc);
1513
1485
  parsedToc.base = pathToDir;
1514
1486
  if (outputFormat === "md") {
1515
- const outputPath = (0, import_path13.resolve)(outputFolderPath, path);
1487
+ const outputPath = (0, import_path14.resolve)(outputFolderPath, path);
1516
1488
  const outputToc = (0, import_js_yaml4.dump)(parsedToc);
1517
- import_shelljs2.default.mkdir("-p", (0, import_path13.dirname)(outputPath));
1489
+ import_shelljs2.default.mkdir("-p", (0, import_path14.dirname)(outputPath));
1518
1490
  (0, import_fs3.writeFileSync)(outputPath, outputToc);
1519
1491
  }
1520
1492
  prepareNavigationPaths(parsedToc, pathToDir);
@@ -1557,7 +1529,7 @@ function prepareNavigationPaths(parsedToc, dirPath) {
1557
1529
  processItems(preparedSubItems, pathToDir);
1558
1530
  }
1559
1531
  if (item.href && !isExternalHref(item.href)) {
1560
- const href = (0, import_path13.join)(pathToDir, item.href);
1532
+ const href = (0, import_path14.join)(pathToDir, item.href);
1561
1533
  storage.set(href, parsedToc);
1562
1534
  const navigationPath = _normalizeHref(href);
1563
1535
  navigationPaths.push(navigationPath);
@@ -1567,32 +1539,32 @@ function prepareNavigationPaths(parsedToc, dirPath) {
1567
1539
  processItems([parsedToc], dirPath);
1568
1540
  }
1569
1541
  function _normalizeHref(href) {
1570
- const preparedHref = (0, import_path13.normalize)(href);
1542
+ const preparedHref = (0, import_path14.normalize)(href);
1571
1543
  if (preparedHref.endsWith(".md") || preparedHref.endsWith(".yaml")) {
1572
1544
  return preparedHref;
1573
1545
  }
1574
- if (preparedHref.endsWith(import_path13.sep)) {
1546
+ if (preparedHref.endsWith(import_path14.sep)) {
1575
1547
  return `${preparedHref}index.yaml`;
1576
1548
  }
1577
1549
  return `${preparedHref}.md`;
1578
1550
  }
1579
1551
  function _copyTocDir(tocPath, destDir) {
1580
1552
  const { input: inputFolderPath } = argv_default.getConfig();
1581
- const { dir: tocDir } = (0, import_path13.parse)(tocPath);
1553
+ const { dir: tocDir } = (0, import_path14.parse)(tocPath);
1582
1554
  const files = (0, import_walk_sync.default)(tocDir, {
1583
1555
  globs: ["**/*.*"],
1584
1556
  ignore: ["**/toc.yaml"],
1585
1557
  directories: false
1586
1558
  });
1587
1559
  files.forEach((relPath) => {
1588
- const from = (0, import_path13.resolve)(tocDir, relPath);
1589
- const to = (0, import_path13.resolve)(destDir, relPath);
1590
- const fileExtension = (0, import_path13.extname)(relPath);
1560
+ const from = (0, import_path14.resolve)(tocDir, relPath);
1561
+ const to = (0, import_path14.resolve)(destDir, relPath);
1562
+ const fileExtension = (0, import_path14.extname)(relPath);
1591
1563
  const isMdFile = fileExtension === ".md";
1592
- import_shelljs2.default.mkdir("-p", (0, import_path13.parse)(to).dir);
1564
+ import_shelljs2.default.mkdir("-p", (0, import_path14.parse)(to).dir);
1593
1565
  if (isMdFile) {
1594
1566
  const fileContent = (0, import_fs3.readFileSync)(from, "utf8");
1595
- const sourcePath = (0, import_path13.relative)(inputFolderPath, from);
1567
+ const sourcePath = (0, import_path14.relative)(inputFolderPath, from);
1596
1568
  const updatedFileContent = getContentWithUpdatedStaticMetadata({
1597
1569
  fileContent,
1598
1570
  sourcePath,
@@ -1607,14 +1579,14 @@ function _copyTocDir(tocPath, destDir) {
1607
1579
  function _replaceIncludesHrefs(items, includeTocDir, tocDir) {
1608
1580
  return items.reduce((acc, tocItem) => {
1609
1581
  if (tocItem.href) {
1610
- tocItem.href = (0, import_path13.relative)(tocDir, (0, import_path13.resolve)(includeTocDir, tocItem.href));
1582
+ tocItem.href = (0, import_path14.relative)(tocDir, (0, import_path14.resolve)(includeTocDir, tocItem.href));
1611
1583
  }
1612
1584
  if (tocItem.items) {
1613
1585
  tocItem.items = _replaceIncludesHrefs(tocItem.items, includeTocDir, tocDir);
1614
1586
  }
1615
1587
  if (tocItem.include) {
1616
1588
  const { path } = tocItem.include;
1617
- tocItem.include.path = (0, import_path13.relative)(tocDir, (0, import_path13.resolve)(includeTocDir, path));
1589
+ tocItem.include.path = (0, import_path14.relative)(tocDir, (0, import_path14.resolve)(includeTocDir, path));
1618
1590
  }
1619
1591
  return acc.concat(tocItem);
1620
1592
  }, []);
@@ -1638,7 +1610,7 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
1638
1610
  for (const item of items) {
1639
1611
  let includedInlineItems = null;
1640
1612
  if (item.name) {
1641
- const tocPath = (0, import_path13.join)(tocDir, "toc.yaml");
1613
+ const tocPath = (0, import_path14.join)(tocDir, "toc.yaml");
1642
1614
  item.name = _liquidSubstitutions(item.name, vars, tocPath);
1643
1615
  }
1644
1616
  try {
@@ -1652,8 +1624,8 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
1652
1624
  }
1653
1625
  if (item.include) {
1654
1626
  const { mode = "root_merge" /* ROOT_MERGE */ } = item.include;
1655
- const includeTocPath = mode === "root_merge" /* ROOT_MERGE */ ? (0, import_path13.resolve)(sourcesDir, item.include.path) : (0, import_path13.resolve)(tocDir, item.include.path);
1656
- const includeTocDir = (0, import_path13.dirname)(includeTocPath);
1627
+ const includeTocPath = mode === "root_merge" /* ROOT_MERGE */ ? (0, import_path14.resolve)(sourcesDir, item.include.path) : (0, import_path14.resolve)(tocDir, item.include.path);
1628
+ const includeTocDir = (0, import_path14.dirname)(includeTocPath);
1657
1629
  try {
1658
1630
  const includeToc = (0, import_js_yaml4.load)((0, import_fs3.readFileSync)(includeTocPath, "utf8"));
1659
1631
  if (includeToc.stage === "tech-preview" /* TECH_PREVIEW */) {
@@ -1686,7 +1658,7 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
1686
1658
  }
1687
1659
  } catch (err) {
1688
1660
  const message = `Error while including toc: ${(0, import_chalk2.bold)(includeTocPath)} to ${(0, import_chalk2.bold)(
1689
- (0, import_path13.join)(tocDir, "toc.yaml")
1661
+ (0, import_path14.join)(tocDir, "toc.yaml")
1690
1662
  )}`;
1691
1663
  import_log3.default.error(message);
1692
1664
  continue;
@@ -1707,8 +1679,8 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
1707
1679
  }
1708
1680
  function getTocDir(pagePath) {
1709
1681
  const { input: inputFolderPath } = argv_default.getConfig();
1710
- const tocDir = (0, import_path13.dirname)(pagePath);
1711
- const tocPath = (0, import_path13.resolve)(tocDir, "toc.yaml");
1682
+ const tocDir = (0, import_path14.dirname)(pagePath);
1683
+ const tocPath = (0, import_path14.resolve)(tocDir, "toc.yaml");
1712
1684
  if (!tocDir.includes(inputFolderPath)) {
1713
1685
  throw new Error("Error while finding toc dir");
1714
1686
  }
@@ -1730,19 +1702,19 @@ var tocs_default = {
1730
1702
  };
1731
1703
 
1732
1704
  // src/services/preset.ts
1733
- var import_path14 = require("path");
1705
+ var import_path15 = require("path");
1734
1706
  var presetStorage = /* @__PURE__ */ new Map();
1735
1707
  function add2(parsedPreset, path, varsPreset) {
1736
1708
  const combinedValues = __spreadValues(__spreadValues({}, parsedPreset.default || {}), parsedPreset[varsPreset] || {});
1737
- const key = (0, import_path14.dirname)((0, import_path14.normalize)(path));
1709
+ const key = (0, import_path15.dirname)((0, import_path15.normalize)(path));
1738
1710
  presetStorage.set(key, combinedValues);
1739
1711
  }
1740
1712
  function get(path) {
1741
1713
  let combinedValues = {};
1742
- let localPath = (0, import_path14.normalize)(path);
1714
+ let localPath = (0, import_path15.normalize)(path);
1743
1715
  while (localPath !== ".") {
1744
1716
  const presetValues = presetStorage.get(localPath) || {};
1745
- localPath = (0, import_path14.dirname)(localPath);
1717
+ localPath = (0, import_path15.dirname)(localPath);
1746
1718
  combinedValues = __spreadValues(__spreadValues({}, presetValues), combinedValues);
1747
1719
  }
1748
1720
  combinedValues = __spreadValues(__spreadValues({}, presetStorage.get(".")), combinedValues);
@@ -1762,7 +1734,7 @@ var preset_default = {
1762
1734
  };
1763
1735
 
1764
1736
  // src/services/argv.ts
1765
- var import_path15 = require("path");
1737
+ var import_path16 = require("path");
1766
1738
  var import_fs4 = require("fs");
1767
1739
  var _argv;
1768
1740
  function getConfig() {
@@ -1776,7 +1748,7 @@ function init2(argv) {
1776
1748
  _argv.vars = JSON.parse(argv.vars);
1777
1749
  }
1778
1750
  try {
1779
- const ignorefile = (0, import_fs4.readFileSync)((0, import_path15.join)(_argv.rootInput, ".yfmignore"), "utf8");
1751
+ const ignorefile = (0, import_fs4.readFileSync)((0, import_path16.join)(_argv.rootInput, ".yfmignore"), "utf8");
1780
1752
  const ignore = ignorefile.split("\n");
1781
1753
  _argv.ignore = _argv.ignore.concat(ignore);
1782
1754
  } catch (e) {
@@ -1792,15 +1764,15 @@ var argv_default = {
1792
1764
  };
1793
1765
 
1794
1766
  // src/services/leading.ts
1795
- var import_path16 = require("path");
1767
+ var import_path17 = require("path");
1796
1768
  var import_fs5 = require("fs");
1797
1769
  var import_js_yaml5 = require("js-yaml");
1798
1770
  var import_log4 = __toESM(require("@diplodoc/transform/lib/log"));
1799
1771
  function filterFile(path) {
1800
1772
  var _a, _b;
1801
1773
  const { input: inputFolderPath, vars } = argv_default.getConfig();
1802
- const pathToDir = (0, import_path16.dirname)(path);
1803
- const filePath = (0, import_path16.resolve)(inputFolderPath, path);
1774
+ const pathToDir = (0, import_path17.dirname)(path);
1775
+ const filePath = (0, import_path17.resolve)(inputFolderPath, path);
1804
1776
  const content = (0, import_fs5.readFileSync)(filePath, "utf8");
1805
1777
  const parsedIndex = (0, import_js_yaml5.load)(content);
1806
1778
  const combinedVars = __spreadValues(__spreadValues({}, preset_default.get(pathToDir)), vars);
@@ -1928,7 +1900,6 @@ var import_includer = __toESM(require("@diplodoc/openapi-extension/includer"));
1928
1900
  // src/steps/processAssets.ts
1929
1901
  var import_walk_sync2 = __toESM(require("walk-sync"));
1930
1902
  var import_shelljs3 = __toESM(require("shelljs"));
1931
- var import_client3 = __toESM(require_client());
1932
1903
  function processAssets(outputBundlePath) {
1933
1904
  const { input: inputFolderPath, output: outputFolderPath } = argv_default.getConfig();
1934
1905
  const assetFilePath = (0, import_walk_sync2.default)(inputFolderPath, {
@@ -1938,13 +1909,11 @@ function processAssets(outputBundlePath) {
1938
1909
  });
1939
1910
  copyFiles(inputFolderPath, outputFolderPath, assetFilePath);
1940
1911
  import_shelljs3.default.mkdir("-p", outputBundlePath);
1941
- for (const path of Object.values(import_client3.default.dst)) {
1942
- import_shelljs3.default.cp(path, outputBundlePath);
1943
- }
1912
+ import_shelljs3.default.cp(ASSETS_FOLDER + "/*", outputBundlePath);
1944
1913
  }
1945
1914
 
1946
1915
  // src/steps/processExcludedFiles.ts
1947
- var import_path17 = require("path");
1916
+ var import_path18 = require("path");
1948
1917
  var import_walk_sync3 = __toESM(require("walk-sync"));
1949
1918
  var import_shelljs4 = __toESM(require("shelljs"));
1950
1919
  function processExcludedFiles() {
@@ -1957,14 +1926,14 @@ function processExcludedFiles() {
1957
1926
  ignore: ["**/_*/**/*"]
1958
1927
  });
1959
1928
  const navigationPaths2 = tocs_default.getNavigationPaths().map(
1960
- (filePath) => convertBackSlashToSlash((0, import_path17.resolve)(inputFolderPath, filePath))
1929
+ (filePath) => convertBackSlashToSlash((0, import_path18.resolve)(inputFolderPath, filePath))
1961
1930
  );
1962
1931
  const tocSpecifiedFiles = new Set(navigationPaths2);
1963
1932
  const excludedFiles = allContentFiles.filter((filePath) => !tocSpecifiedFiles.has(filePath));
1964
1933
  import_shelljs4.default.rm("-f", excludedFiles);
1965
1934
  const includedTocPaths2 = tocs_default.getIncludedTocPaths().map((filePath) => {
1966
- const relativeTocPath = (0, import_path17.relative)(inputFolderPath, filePath);
1967
- const destTocPath = (0, import_path17.resolve)(outputFolderPath, relativeTocPath);
1935
+ const relativeTocPath = (0, import_path18.relative)(inputFolderPath, filePath);
1936
+ const destTocPath = (0, import_path18.resolve)(outputFolderPath, relativeTocPath);
1968
1937
  return convertBackSlashToSlash(destTocPath);
1969
1938
  });
1970
1939
  import_shelljs4.default.rm("-rf", includedTocPaths2);
@@ -1984,7 +1953,7 @@ function processLogs(inputFolder) {
1984
1953
  }
1985
1954
 
1986
1955
  // src/steps/processPages.ts
1987
- var import_path22 = require("path");
1956
+ var import_path23 = require("path");
1988
1957
  var import_shelljs6 = __toESM(require("shelljs"));
1989
1958
  var import_fs9 = require("fs");
1990
1959
  var import_chalk4 = require("chalk");
@@ -1994,7 +1963,7 @@ var import_log11 = __toESM(require("@diplodoc/transform/lib/log"));
1994
1963
 
1995
1964
  // src/resolvers/md2md.ts
1996
1965
  var import_fs6 = require("fs");
1997
- var import_path18 = require("path");
1966
+ var import_path19 = require("path");
1998
1967
  var import_shelljs5 = __toESM(require("shelljs"));
1999
1968
  var import_log6 = __toESM(require("@diplodoc/transform/lib/log"));
2000
1969
  var import_liquid3 = __toESM(require("@diplodoc/transform/lib/liquid"));
@@ -2002,7 +1971,7 @@ function resolveMd2Md(options) {
2002
1971
  return __async(this, null, function* () {
2003
1972
  const { inputPath, outputPath, metadata } = options;
2004
1973
  const { input, output } = argv_default.getConfig();
2005
- const resolvedInputPath = (0, import_path18.resolve)(input, inputPath);
1974
+ const resolvedInputPath = (0, import_path19.resolve)(input, inputPath);
2006
1975
  const vars = getVarsPerFile(inputPath);
2007
1976
  const content = yield getContentWithUpdatedMetadata(
2008
1977
  (0, import_fs6.readFileSync)(resolvedInputPath, "utf8"),
@@ -2012,8 +1981,8 @@ function resolveMd2Md(options) {
2012
1981
  const { result, changelogs } = transformMd2Md(content, {
2013
1982
  path: resolvedInputPath,
2014
1983
  destPath: outputPath,
2015
- root: (0, import_path18.resolve)(input),
2016
- destRoot: (0, import_path18.resolve)(output),
1984
+ root: (0, import_path19.resolve)(input),
1985
+ destRoot: (0, import_path19.resolve)(output),
2017
1986
  collectOfPlugins: plugins_exports.getCollectOfPlugins(),
2018
1987
  vars,
2019
1988
  log: import_log6.default,
@@ -2021,8 +1990,8 @@ function resolveMd2Md(options) {
2021
1990
  });
2022
1991
  (0, import_fs6.writeFileSync)(outputPath, result);
2023
1992
  if (changelogs == null ? void 0 : changelogs.length) {
2024
- const mdFilename = (0, import_path18.basename)(outputPath, (0, import_path18.extname)(outputPath));
2025
- const outputDir = (0, import_path18.dirname)(outputPath);
1993
+ const mdFilename = (0, import_path19.basename)(outputPath, (0, import_path19.extname)(outputPath));
1994
+ const outputDir = (0, import_path19.dirname)(outputPath);
2026
1995
  changelogs.forEach((changes, index) => {
2027
1996
  let changesName;
2028
1997
  const changesDate = changes.date;
@@ -2039,7 +2008,7 @@ function resolveMd2Md(options) {
2039
2008
  "0"
2040
2009
  )}`;
2041
2010
  }
2042
- const changesPath = (0, import_path18.join)(outputDir, `changes-${changesName}.json`);
2011
+ const changesPath = (0, import_path19.join)(outputDir, `changes-${changesName}.json`);
2043
2012
  if ((0, import_fs6.existsSync)(changesPath)) {
2044
2013
  throw new Error(`Changelog ${changesPath} already exists!`);
2045
2014
  }
@@ -2056,7 +2025,7 @@ function resolveMd2Md(options) {
2056
2025
  });
2057
2026
  }
2058
2027
  function copyFile(targetPath, targetDestPath, options) {
2059
- import_shelljs5.default.mkdir("-p", (0, import_path18.dirname)(targetDestPath));
2028
+ import_shelljs5.default.mkdir("-p", (0, import_path19.dirname)(targetDestPath));
2060
2029
  if (options) {
2061
2030
  const sourceIncludeContent = (0, import_fs6.readFileSync)(targetPath, "utf8");
2062
2031
  const { result } = transformMd2Md(sourceIncludeContent, options);
@@ -2115,7 +2084,7 @@ function transformMd2Md(input, options) {
2115
2084
  }
2116
2085
 
2117
2086
  // src/resolvers/md2html.ts
2118
- var import_path19 = require("path");
2087
+ var import_path20 = require("path");
2119
2088
  var import_fs7 = require("fs");
2120
2089
  var import_js_yaml6 = __toESM(require("js-yaml"));
2121
2090
  var import_transform = __toESM(require("@diplodoc/transform"));
@@ -2126,22 +2095,25 @@ var FileTransformer = {
2126
2095
  ".md": MdFileTransformer
2127
2096
  };
2128
2097
  var fixRelativePath = (relativeTo) => (path) => {
2129
- return (0, import_path19.join)(getAssetsPublicPath(relativeTo), path);
2098
+ return (0, import_path20.join)(getAssetsPublicPath(relativeTo), path);
2130
2099
  };
2131
2100
  function resolveMd2HTML(options) {
2132
2101
  return __async(this, null, function* () {
2133
2102
  var _a;
2134
2103
  const { inputPath, fileExtension, outputPath, outputBundlePath, metadata } = options;
2135
- const pathToDir = (0, import_path19.dirname)(inputPath);
2104
+ const pathToDir = (0, import_path20.dirname)(inputPath);
2136
2105
  const toc = tocs_default.getForPath(inputPath) || null;
2137
2106
  const tocBase = toc && toc.base ? toc.base : "";
2138
- const pathToFileDir = pathToDir === tocBase ? "" : pathToDir.replace(`${tocBase}${import_path19.sep}`, "");
2139
- const relativePathToIndex = (0, import_path19.relative)(pathToDir, `${tocBase}${import_path19.sep}`);
2107
+ const pathToFileDir = pathToDir === tocBase ? "" : pathToDir.replace(`${tocBase}${import_path20.sep}`, "");
2108
+ const relativePathToIndex = (0, import_path20.relative)(pathToDir, `${tocBase}${import_path20.sep}`);
2140
2109
  const { input, lang, allowCustomResources } = argv_default.getConfig();
2141
- const resolvedPath = (0, import_path19.resolve)(input, inputPath);
2110
+ const resolvedPath = (0, import_path20.resolve)(input, inputPath);
2142
2111
  const content = (0, import_fs7.readFileSync)(resolvedPath, "utf8");
2143
2112
  const transformFn = FileTransformer[fileExtension];
2144
2113
  const { result } = transformFn(content, { path: inputPath });
2114
+ if (result.html) {
2115
+ result.html = result.html.replace(/\n+/gm, "");
2116
+ }
2145
2117
  const updatedMetadata = metadata && metadata.isContributorsEnabled ? yield getUpdatedMetadata(metadata, content, result == null ? void 0 : result.meta) : result.meta;
2146
2118
  const fileMeta = fileExtension === ".yaml" ? (_a = result.data.meta) != null ? _a : {} : updatedMetadata;
2147
2119
  if (allowCustomResources) {
@@ -2160,12 +2132,12 @@ function resolveMd2HTML(options) {
2160
2132
  meta: fileMeta
2161
2133
  }),
2162
2134
  router: {
2163
- pathname: (0, import_path19.join)(relativePathToIndex, pathToFileDir, (0, import_path19.basename)(outputPath))
2135
+ pathname: (0, import_path20.join)(relativePathToIndex, pathToFileDir, (0, import_path20.basename)(outputPath))
2164
2136
  },
2165
2137
  lang: lang || "ru" /* RU */
2166
2138
  };
2167
- const outputDir = (0, import_path19.dirname)(outputPath);
2168
- const relativePathToBundle = (0, import_path19.relative)((0, import_path19.resolve)(outputDir), (0, import_path19.resolve)(outputBundlePath));
2139
+ const outputDir = (0, import_path20.dirname)(outputPath);
2140
+ const relativePathToBundle = (0, import_path20.relative)((0, import_path20.resolve)(outputDir), (0, import_path20.resolve)(outputBundlePath));
2169
2141
  const outputFileContent = generateStaticMarkup(props, relativePathToBundle);
2170
2142
  (0, import_fs7.writeFileSync)(outputPath, outputFileContent);
2171
2143
  logger.info(inputPath, PROCESSING_FINISHED);
@@ -2207,8 +2179,8 @@ function MdFileTransformer(content, transformOptions) {
2207
2179
  const { path: filePath } = transformOptions;
2208
2180
  const plugins2 = plugins_exports.getPlugins();
2209
2181
  const vars = getVarsPerFile(filePath);
2210
- const root = (0, import_path19.resolve)(input);
2211
- const path = (0, import_path19.resolve)(input, filePath);
2182
+ const root = (0, import_path20.resolve)(input);
2183
+ const path = (0, import_path20.resolve)(input, filePath);
2212
2184
  return (0, import_transform.default)(content, __spreadProps(__spreadValues({}, options), {
2213
2185
  plugins: plugins2,
2214
2186
  vars,
@@ -2221,7 +2193,7 @@ function MdFileTransformer(content, transformOptions) {
2221
2193
  }
2222
2194
 
2223
2195
  // src/resolvers/lintPage.ts
2224
- var import_path20 = require("path");
2196
+ var import_path21 = require("path");
2225
2197
  var import_log8 = __toESM(require("@diplodoc/transform/lib/log"));
2226
2198
  var import_yfmlint = __toESM(require("@diplodoc/transform/lib/yfmlint"));
2227
2199
  var import_fs8 = require("fs");
@@ -2232,7 +2204,7 @@ var FileLinter = {
2232
2204
  function lintPage(options) {
2233
2205
  const { inputPath, fileExtension, onFinish } = options;
2234
2206
  const { input } = argv_default.getConfig();
2235
- const resolvedPath = (0, import_path20.resolve)(input, inputPath);
2207
+ const resolvedPath = (0, import_path21.resolve)(input, inputPath);
2236
2208
  try {
2237
2209
  const content = (0, import_fs8.readFileSync)(resolvedPath, "utf8");
2238
2210
  const lintFn = FileLinter[fileExtension];
@@ -2254,10 +2226,10 @@ function MdFileLinter(content, lintOptions) {
2254
2226
  const { path: filePath } = lintOptions;
2255
2227
  const plugins2 = outputFormat === "md" ? [] : plugins_exports.getPlugins();
2256
2228
  const vars = getVarsPerFile(filePath);
2257
- const root = (0, import_path20.resolve)(input);
2258
- const path = (0, import_path20.resolve)(input, filePath);
2229
+ const root = (0, import_path21.resolve)(input);
2230
+ const path = (0, import_path21.resolve)(input, filePath);
2259
2231
  let preparedContent = content;
2260
- const assetsPublicPath = (0, import_path20.relative)((0, import_path20.dirname)(path), root);
2232
+ const assetsPublicPath = (0, import_path21.relative)((0, import_path21.dirname)(path), root);
2261
2233
  const lintMarkdown = function lintMarkdown2(opts) {
2262
2234
  const { input: localInput, path: localPath, sourceMap: sourceMap2 } = opts;
2263
2235
  const pluginOptions = __spreadProps(__spreadValues({}, options), {
@@ -2301,7 +2273,7 @@ function MdFileLinter(content, lintOptions) {
2301
2273
 
2302
2274
  // src/vcs-connector/github.ts
2303
2275
  var import_core = require("@octokit/core");
2304
- var import_path21 = require("path");
2276
+ var import_path22 = require("path");
2305
2277
  var import_simple_git = __toESM(require("simple-git"));
2306
2278
  var import_minimatch = require("minimatch");
2307
2279
 
@@ -2515,7 +2487,7 @@ function getAllContributorsTocFiles(httpClientByToken) {
2515
2487
  "origin/master"
2516
2488
  );
2517
2489
  const fullRepoLogString = yield (0, import_simple_git.default)({
2518
- baseDir: (0, import_path21.join)(rootInput, masterDir)
2490
+ baseDir: (0, import_path22.join)(rootInput, masterDir)
2519
2491
  }).raw(
2520
2492
  "log",
2521
2493
  `${FIRST_COMMIT_FROM_ROBOT_IN_GITHUB}..HEAD`,
@@ -2525,7 +2497,7 @@ function getAllContributorsTocFiles(httpClientByToken) {
2525
2497
  const repoLogs = fullRepoLogString.split("\n\n");
2526
2498
  if (import_process2.default.env.ENABLE_EXPERIMANTAL_AUTHORS) {
2527
2499
  const fullAuthorRepoLogString = yield (0, import_simple_git.default)({
2528
- baseDir: (0, import_path21.join)(rootInput, masterDir)
2500
+ baseDir: (0, import_path22.join)(rootInput, masterDir)
2529
2501
  }).raw(
2530
2502
  "log",
2531
2503
  `${FIRST_COMMIT_FROM_ROBOT_IN_GITHUB}..HEAD`,
@@ -2622,7 +2594,7 @@ function getAuthorByPaths(commitInfo, paths, httpClientByToken) {
2622
2594
  if (!path) {
2623
2595
  continue;
2624
2596
  }
2625
- const normalizePath = (0, import_path21.normalize)(addSlashPrefix(path));
2597
+ const normalizePath = (0, import_path22.normalize)(addSlashPrefix(path));
2626
2598
  const { email, hashCommit } = commitInfo;
2627
2599
  let authorToReturn = authorByGitEmail.get(email) || null;
2628
2600
  if (!authorToReturn) {
@@ -2683,7 +2655,7 @@ function addNestedContributorsForPathFunction(path, nestedContributors) {
2683
2655
  }
2684
2656
  function addContributorForPath(paths, newContributor, hasIncludes = false) {
2685
2657
  paths.forEach((path) => {
2686
- const normalizePath = (0, import_path21.normalize)(addSlashPrefix(path));
2658
+ const normalizePath = (0, import_path22.normalize)(addSlashPrefix(path));
2687
2659
  if (!contributorsByPath.has(normalizePath)) {
2688
2660
  contributorsByPath.set(normalizePath, {
2689
2661
  contributors: newContributor,
@@ -2778,14 +2750,14 @@ function processPages(outputBundlePath) {
2778
2750
  });
2779
2751
  }
2780
2752
  function getPathData(pathToFile, inputFolderPath, outputFolderPath, outputFormat, outputBundlePath) {
2781
- const pathToDir = (0, import_path22.dirname)(pathToFile);
2782
- const filename = (0, import_path22.basename)(pathToFile);
2783
- const fileExtension = (0, import_path22.extname)(pathToFile);
2784
- const fileBaseName = (0, import_path22.basename)(filename, fileExtension);
2785
- const outputDir = (0, import_path22.resolve)(outputFolderPath, pathToDir);
2753
+ const pathToDir = (0, import_path23.dirname)(pathToFile);
2754
+ const filename = (0, import_path23.basename)(pathToFile);
2755
+ const fileExtension = (0, import_path23.extname)(pathToFile);
2756
+ const fileBaseName = (0, import_path23.basename)(filename, fileExtension);
2757
+ const outputDir = (0, import_path23.resolve)(outputFolderPath, pathToDir);
2786
2758
  const outputFileName = `${fileBaseName}.${outputFormat}`;
2787
- const outputPath = (0, import_path22.resolve)(outputDir, outputFileName);
2788
- const resolvedPathToFile = (0, import_path22.resolve)(inputFolderPath, pathToFile);
2759
+ const outputPath = (0, import_path23.resolve)(outputDir, outputFileName);
2760
+ const resolvedPathToFile = (0, import_path23.resolve)(inputFolderPath, pathToFile);
2789
2761
  const outputTocDir = tocs_default.getTocDir(resolvedPathToFile);
2790
2762
  const pathData = {
2791
2763
  pathToFile,
@@ -2822,11 +2794,11 @@ function saveSinglePages(outputBundlePath) {
2822
2794
  inputFolderPath,
2823
2795
  tocDir
2824
2796
  );
2825
- const tocPath = (0, import_path22.join)((0, import_path22.relative)(inputFolderPath, tocDir), "toc.yaml");
2797
+ const tocPath = (0, import_path23.join)((0, import_path23.relative)(inputFolderPath, tocDir), "toc.yaml");
2826
2798
  const toc = tocs_default.getForPath(tocPath) || null;
2827
2799
  const preparedToc = transformTocForSinglePage(toc, {
2828
2800
  root: inputFolderPath,
2829
- currentPath: (0, import_path22.join)(tocDir, SINGLE_PAGE_FILENAME)
2801
+ currentPath: (0, import_path23.join)(tocDir, SINGLE_PAGE_FILENAME)
2830
2802
  });
2831
2803
  const pageData = {
2832
2804
  data: {
@@ -2841,10 +2813,10 @@ function saveSinglePages(outputBundlePath) {
2841
2813
  },
2842
2814
  lang: lang || "ru" /* RU */
2843
2815
  };
2844
- const outputTocDir = (0, import_path22.resolve)(outputFolderPath, (0, import_path22.relative)(inputFolderPath, tocDir));
2845
- const relativeOutputBundlePath = (0, import_path22.relative)(outputTocDir, outputBundlePath);
2846
- const singlePageFn = (0, import_path22.join)(tocDir, SINGLE_PAGE_FILENAME);
2847
- const singlePageDataFn = (0, import_path22.join)(tocDir, SINGLE_PAGE_DATA_FILENAME);
2816
+ const outputTocDir = (0, import_path23.resolve)(outputFolderPath, (0, import_path23.relative)(inputFolderPath, tocDir));
2817
+ const relativeOutputBundlePath = (0, import_path23.relative)(outputTocDir, outputBundlePath);
2818
+ const singlePageFn = (0, import_path23.join)(tocDir, SINGLE_PAGE_FILENAME);
2819
+ const singlePageDataFn = (0, import_path23.join)(tocDir, SINGLE_PAGE_DATA_FILENAME);
2848
2820
  const singlePageContent = generateStaticMarkup(pageData, relativeOutputBundlePath);
2849
2821
  (0, import_fs9.writeFileSync)(singlePageFn, singlePageContent);
2850
2822
  (0, import_fs9.writeFileSync)(singlePageDataFn, JSON.stringify(pageData));
@@ -2942,17 +2914,17 @@ function preparingPagesByOutputFormat(path, metaDataOptions, resolveConditions,
2942
2914
  }
2943
2915
  function processingYamlFile(path, metaDataOptions) {
2944
2916
  const { pathToFile, outputFolderPath, inputFolderPath } = path;
2945
- const filePath = (0, import_path22.resolve)(inputFolderPath, pathToFile);
2917
+ const filePath = (0, import_path23.resolve)(inputFolderPath, pathToFile);
2946
2918
  const content = (0, import_fs9.readFileSync)(filePath, "utf8");
2947
2919
  const parsedContent = (0, import_js_yaml7.load)(content);
2948
2920
  if (metaDataOptions.resources) {
2949
2921
  parsedContent.meta = __spreadValues(__spreadValues({}, parsedContent.meta), metaDataOptions.resources);
2950
2922
  }
2951
- (0, import_fs9.writeFileSync)((0, import_path22.resolve)(outputFolderPath, pathToFile), (0, import_js_yaml7.dump)(parsedContent));
2923
+ (0, import_fs9.writeFileSync)((0, import_path23.resolve)(outputFolderPath, pathToFile), (0, import_js_yaml7.dump)(parsedContent));
2952
2924
  }
2953
2925
  function copyFileWithoutChanges(resolvedPathToFile, outputDir, filename) {
2954
2926
  const from = resolvedPathToFile;
2955
- const to = (0, import_path22.resolve)(outputDir, filename);
2927
+ const to = (0, import_path23.resolve)(outputDir, filename);
2956
2928
  import_shelljs6.default.cp(from, to);
2957
2929
  }
2958
2930
  function processingFileToMd(path, metaDataOptions) {
@@ -2982,7 +2954,7 @@ function processingFileToHtml(path, metaDataOptions) {
2982
2954
  // src/steps/processLinter.ts
2983
2955
  var import_log12 = __toESM(require("@diplodoc/transform/lib/log"));
2984
2956
  var import_threads = require("threads");
2985
- var import_path23 = require("path");
2957
+ var import_path24 = require("path");
2986
2958
 
2987
2959
  // src/utils/worker.ts
2988
2960
  function splitOnChunks(array, chunkSize = 1e3) {
@@ -3059,7 +3031,7 @@ function lintPagesFallback(navigationPaths2) {
3059
3031
  navigationPaths2.forEach((pathToFile) => {
3060
3032
  lintPage({
3061
3033
  inputPath: pathToFile,
3062
- fileExtension: (0, import_path23.extname)(pathToFile),
3034
+ fileExtension: (0, import_path24.extname)(pathToFile),
3063
3035
  onFinish: () => {
3064
3036
  logger.info(pathToFile, LINTING_FINISHED);
3065
3037
  }
@@ -3068,7 +3040,7 @@ function lintPagesFallback(navigationPaths2) {
3068
3040
  }
3069
3041
 
3070
3042
  // src/steps/processServiceFiles.ts
3071
- var import_path24 = require("path");
3043
+ var import_path25 = require("path");
3072
3044
  var import_walk_sync4 = __toESM(require("walk-sync"));
3073
3045
  var import_fs10 = require("fs");
3074
3046
  var import_js_yaml8 = require("js-yaml");
@@ -3101,7 +3073,7 @@ function preparingPresetFiles(getFilePathsByGlobals) {
3101
3073
  const presetsFilePaths = getFilePathsByGlobals(["**/presets.yaml"]);
3102
3074
  for (const path of presetsFilePaths) {
3103
3075
  logger.proc(path);
3104
- const pathToPresetFile = (0, import_path24.resolve)(inputFolderPath, path);
3076
+ const pathToPresetFile = (0, import_path25.resolve)(inputFolderPath, path);
3105
3077
  const content = (0, import_fs10.readFileSync)(pathToPresetFile, "utf8");
3106
3078
  const parsedPreset = (0, import_js_yaml8.load)(content);
3107
3079
  preset_default.add(parsedPreset, path, varsPreset);
@@ -3116,7 +3088,7 @@ function preparingPresetFiles(getFilePathsByGlobals) {
3116
3088
  }
3117
3089
  function saveFilteredPresets(path, parsedPreset) {
3118
3090
  const { output: outputFolderPath, varsPreset = "" } = argv_default.getConfig();
3119
- const outputPath = (0, import_path24.resolve)(outputFolderPath, path);
3091
+ const outputPath = (0, import_path25.resolve)(outputFolderPath, path);
3120
3092
  const filteredPreset = {
3121
3093
  default: parsedPreset.default
3122
3094
  };
@@ -3126,7 +3098,7 @@ function saveFilteredPresets(path, parsedPreset) {
3126
3098
  const outputPreset = (0, import_js_yaml8.dump)(filteredPreset, {
3127
3099
  lineWidth: 120
3128
3100
  });
3129
- import_shelljs7.default.mkdir("-p", (0, import_path24.dirname)(outputPath));
3101
+ import_shelljs7.default.mkdir("-p", (0, import_path25.dirname)(outputPath));
3130
3102
  (0, import_fs10.writeFileSync)(outputPath, outputPreset);
3131
3103
  }
3132
3104
  function preparingTocFiles(getFilePathsByGlobals) {
@@ -3146,11 +3118,11 @@ function preparingTocFiles(getFilePathsByGlobals) {
3146
3118
 
3147
3119
  // src/steps/processMapFile.ts
3148
3120
  var import_fs11 = require("fs");
3149
- var import_path25 = require("path");
3121
+ var import_path26 = require("path");
3150
3122
  function prepareMapFile() {
3151
3123
  const { output: outputFolderPath } = argv_default.getConfig();
3152
3124
  const navigationPathsWithoutExtensions = tocs_default.getNavigationPaths().map((path) => {
3153
- let preparedPath = convertBackSlashToSlash(path.replace((0, import_path25.extname)(path), ""));
3125
+ let preparedPath = convertBackSlashToSlash(path.replace((0, import_path26.extname)(path), ""));
3154
3126
  if (preparedPath.endsWith("/index")) {
3155
3127
  preparedPath = preparedPath.substring(0, preparedPath.length - 5);
3156
3128
  }
@@ -3158,7 +3130,7 @@ function prepareMapFile() {
3158
3130
  });
3159
3131
  const navigationPaths2 = { files: [...new Set(navigationPathsWithoutExtensions)] };
3160
3132
  const filesMapBuffer = Buffer.from(JSON.stringify(navigationPaths2, null, " "), "utf8");
3161
- const mapFile = (0, import_path25.join)(outputFolderPath, "files.json");
3133
+ const mapFile = (0, import_path26.join)(outputFolderPath, "files.json");
3162
3134
  (0, import_fs11.writeFileSync)(mapFile, filesMapBuffer);
3163
3135
  }
3164
3136
 
@@ -3168,7 +3140,7 @@ var import_shelljs8 = __toESM(require("shelljs"));
3168
3140
  // src/cmd/publish/upload.ts
3169
3141
  var import_fs12 = require("fs");
3170
3142
  var import_walk_sync5 = __toESM(require("walk-sync"));
3171
- var import_path26 = require("path");
3143
+ var import_path27 = require("path");
3172
3144
  var import_client_s3 = require("@aws-sdk/client-s3");
3173
3145
  var import_mime_types = __toESM(require("mime-types"));
3174
3146
  var import_async2 = require("async");
@@ -3189,7 +3161,7 @@ function upload(props) {
3189
3161
  region,
3190
3162
  credentials: { accessKeyId, secretAccessKey }
3191
3163
  });
3192
- const filesToPublish = (0, import_walk_sync5.default)((0, import_path26.resolve)(input), {
3164
+ const filesToPublish = (0, import_walk_sync5.default)((0, import_path27.resolve)(input), {
3193
3165
  directories: false,
3194
3166
  includeBasePath: false,
3195
3167
  ignore
@@ -3205,8 +3177,8 @@ function upload(props) {
3205
3177
  new import_client_s3.PutObjectCommand({
3206
3178
  ContentType: mimeType ? mimeType : void 0,
3207
3179
  Bucket: bucket,
3208
- Key: convertBackSlashToSlash((0, import_path26.join)(prefix, pathToFile)),
3209
- Body: (0, import_fs12.createReadStream)((0, import_path26.resolve)(input, pathToFile))
3180
+ Key: convertBackSlashToSlash((0, import_path27.join)(prefix, pathToFile)),
3181
+ Body: (0, import_fs12.createReadStream)((0, import_path27.resolve)(input, pathToFile))
3210
3182
  })
3211
3183
  );
3212
3184
  } catch (error) {
@@ -3341,9 +3313,9 @@ function builder(argv) {
3341
3313
  function handler(args) {
3342
3314
  return __async(this, null, function* () {
3343
3315
  var _a;
3344
- const userOutputFolder = (0, import_path27.resolve)(args.output);
3345
- const tmpInputFolder = (0, import_path27.resolve)(args.output, TMP_INPUT_FOLDER);
3346
- const tmpOutputFolder = (0, import_path27.resolve)(args.output, TMP_OUTPUT_FOLDER);
3316
+ const userOutputFolder = (0, import_path28.resolve)(args.output);
3317
+ const tmpInputFolder = (0, import_path28.resolve)(args.output, TMP_INPUT_FOLDER);
3318
+ const tmpOutputFolder = (0, import_path28.resolve)(args.output, TMP_OUTPUT_FOLDER);
3347
3319
  try {
3348
3320
  argv_default.init(__spreadProps(__spreadValues({}, args), {
3349
3321
  rootInput: args.input,
@@ -3367,10 +3339,10 @@ function handler(args) {
3367
3339
  if (addMapFile) {
3368
3340
  prepareMapFile();
3369
3341
  }
3370
- const outputBundlePath = (0, import_path27.join)(outputFolderPath, BUNDLE_FOLDER);
3371
- const pathToConfig = args.config || (0, import_path27.join)(args.input, YFM_CONFIG_FILENAME);
3372
- const pathToRedirects = (0, import_path27.join)(args.input, REDIRECTS_FILENAME);
3373
- const pathToLintConfig = (0, import_path27.join)(args.input, LINT_CONFIG_FILENAME);
3342
+ const outputBundlePath = (0, import_path28.join)(outputFolderPath, BUNDLE_FOLDER);
3343
+ const pathToConfig = args.config || (0, import_path28.join)(args.input, YFM_CONFIG_FILENAME);
3344
+ const pathToRedirects = (0, import_path28.join)(args.input, REDIRECTS_FILENAME);
3345
+ const pathToLintConfig = (0, import_path28.join)(args.input, LINT_CONFIG_FILENAME);
3374
3346
  if (!lintDisabled) {
3375
3347
  yield initLinterWorkers();
3376
3348
  }
@@ -3385,9 +3357,9 @@ function handler(args) {
3385
3357
  processAssets(outputBundlePath);
3386
3358
  break;
3387
3359
  case "md": {
3388
- import_shelljs8.default.cp((0, import_path27.resolve)(pathToConfig), tmpOutputFolder);
3389
- import_shelljs8.default.cp((0, import_path27.resolve)(pathToRedirects), tmpOutputFolder);
3390
- import_shelljs8.default.cp((0, import_path27.resolve)(pathToLintConfig), tmpOutputFolder);
3360
+ import_shelljs8.default.cp((0, import_path28.resolve)(pathToConfig), tmpOutputFolder);
3361
+ import_shelljs8.default.cp((0, import_path28.resolve)(pathToRedirects), tmpOutputFolder);
3362
+ import_shelljs8.default.cp((0, import_path28.resolve)(pathToLintConfig), tmpOutputFolder);
3391
3363
  if (resources && allowCustomResources) {
3392
3364
  const resourcePaths = [];
3393
3365
  Object.keys(resources).forEach(
@@ -3405,7 +3377,7 @@ function handler(args) {
3405
3377
  }
3406
3378
  import_shelljs8.default.cp(
3407
3379
  "-r",
3408
- [(0, import_path27.join)(tmpOutputFolder, "*"), (0, import_path27.join)(tmpOutputFolder, ".*")],
3380
+ [(0, import_path28.join)(tmpOutputFolder, "*"), (0, import_path28.join)(tmpOutputFolder, ".*")],
3409
3381
  userOutputFolder
3410
3382
  );
3411
3383
  if (publish2) {
@@ -3458,7 +3430,7 @@ function preparingTemporaryFolders(userOutputFolder) {
3458
3430
  }
3459
3431
 
3460
3432
  // src/cmd/publish/index.ts
3461
- var import_path28 = require("path");
3433
+ var import_path29 = require("path");
3462
3434
  var command = "publish";
3463
3435
  var description = "Upload builded documentation to target S3 bucket";
3464
3436
  var publish = {
@@ -3511,10 +3483,11 @@ function builder2(argv) {
3511
3483
  function handler2(args) {
3512
3484
  return __async(this, null, function* () {
3513
3485
  argv_default.init(__spreadValues({}, args));
3514
- const { input, endpoint, bucket, prefix } = argv_default.getConfig();
3515
- logger.info("", `Upload artifacts from ${input} to ${(0, import_path28.join)(endpoint, bucket, prefix)}`);
3486
+ const config = argv_default.getConfig();
3487
+ const { input, endpoint, bucket, prefix } = config;
3488
+ logger.info("", `Upload artifacts from ${input} to ${(0, import_path29.join)(endpoint, bucket, prefix)}`);
3516
3489
  try {
3517
- yield upload(argv_default.getConfig());
3490
+ yield upload(config);
3518
3491
  } catch (error) {
3519
3492
  logger.error("", error.message);
3520
3493
  }
@@ -3522,7 +3495,7 @@ function handler2(args) {
3522
3495
  }
3523
3496
 
3524
3497
  // src/cmd/xliff/extract.ts
3525
- var import_path29 = require("path");
3498
+ var import_path30 = require("path");
3526
3499
  var import_markdown_translation = __toESM(require("@diplodoc/markdown-translation"));
3527
3500
  var import_async3 = require("async");
3528
3501
  var {
@@ -3585,7 +3558,7 @@ function handler3(args) {
3585
3558
  try {
3586
3559
  ({
3587
3560
  state: { found, cache }
3588
- } = yield glob((0, import_path29.join)(input, MD_GLOB2), {
3561
+ } = yield glob((0, import_path30.join)(input, MD_GLOB2), {
3589
3562
  nosort: true,
3590
3563
  cache
3591
3564
  }));
@@ -3619,9 +3592,9 @@ function pipeline2(params) {
3619
3592
  const { input, output, source, target } = params;
3620
3593
  return (markdownPath) => __async(this, null, function* () {
3621
3594
  const markdown = yield reader({ path: markdownPath });
3622
- const extension = (0, import_path29.extname)(markdownPath);
3595
+ const extension = (0, import_path30.extname)(markdownPath);
3623
3596
  const outputRelativePath = markdownPath.replace(extension, "").slice(input.length);
3624
- const outputPath = (0, import_path29.join)(output, outputRelativePath);
3597
+ const outputPath = (0, import_path30.join)(output, outputRelativePath);
3625
3598
  const xlfPath = outputPath + ".xliff";
3626
3599
  const skeletonPath = outputPath + ".skl.md";
3627
3600
  const extractParameters = {
@@ -3675,7 +3648,7 @@ function writer(params) {
3675
3648
  const { xlfPath, skeletonPath, xlf, skeleton } = params;
3676
3649
  logger.info(params.xlfPath, "writing xliff file");
3677
3650
  logger.info(params.skeletonPath, "writing skeleton file");
3678
- yield mkdir2((0, import_path29.dirname)(xlfPath), { recursive: true });
3651
+ yield mkdir2((0, import_path30.dirname)(xlfPath), { recursive: true });
3679
3652
  yield Promise.all([writeFile2(skeletonPath, skeleton), writeFile2(xlfPath, xlf)]);
3680
3653
  logger.info(params.xlfPath, "finished writing xliff file");
3681
3654
  logger.info(params.skeletonPath, "finished writing skeleton file");
@@ -3683,7 +3656,7 @@ function writer(params) {
3683
3656
  }
3684
3657
 
3685
3658
  // src/cmd/xliff/compose.ts
3686
- var import_path30 = require("path");
3659
+ var import_path31 = require("path");
3687
3660
  var import_markdown_translation2 = __toESM(require("@diplodoc/markdown-translation"));
3688
3661
  var import_async4 = require("async");
3689
3662
  var {
@@ -3723,13 +3696,13 @@ function handler4(args) {
3723
3696
  try {
3724
3697
  ({
3725
3698
  state: { found: skeletonPaths, cache }
3726
- } = yield glob((0, import_path30.join)(input, SKL_MD_GLOB), {
3699
+ } = yield glob((0, import_path31.join)(input, SKL_MD_GLOB), {
3727
3700
  nosort: false,
3728
3701
  cache
3729
3702
  }));
3730
3703
  ({
3731
3704
  state: { found: xliffPaths, cache }
3732
- } = yield glob((0, import_path30.join)(input, XLF_GLOB), {
3705
+ } = yield glob((0, import_path31.join)(input, XLF_GLOB), {
3733
3706
  nosort: false,
3734
3707
  cache
3735
3708
  }));
@@ -3759,7 +3732,7 @@ function handler4(args) {
3759
3732
  function pipeline3(params) {
3760
3733
  const { input, output } = params;
3761
3734
  return (xliffPath) => __async(this, null, function* () {
3762
- const extension = (0, import_path30.extname)(xliffPath);
3735
+ const extension = (0, import_path31.extname)(xliffPath);
3763
3736
  const extensionLessPath = xliffPath.replace(extension, "");
3764
3737
  const skeletonPath = extensionLessPath + ".skl.md";
3765
3738
  const readerParameters = { xliffPath, skeletonPath };
@@ -3770,7 +3743,7 @@ function pipeline3(params) {
3770
3743
  });
3771
3744
  const { markdown } = yield composer(composerParameters);
3772
3745
  const inputRelativePath = extensionLessPath.slice(input.length);
3773
- const markdownPath = (0, import_path30.join)(output, inputRelativePath) + ".md";
3746
+ const markdownPath = (0, import_path31.join)(output, inputRelativePath) + ".md";
3774
3747
  const writerParameters = {
3775
3748
  markdown,
3776
3749
  markdownPath
@@ -3827,7 +3800,7 @@ function writer2(params) {
3827
3800
  const { markdown, markdownPath } = params;
3828
3801
  try {
3829
3802
  logger.info(markdownPath, "writing markdown file");
3830
- yield mkdir3((0, import_path30.dirname)(markdownPath), { recursive: true });
3803
+ yield mkdir3((0, import_path31.dirname)(markdownPath), { recursive: true });
3831
3804
  yield writeFile3(markdownPath, markdown);
3832
3805
  logger.info(markdownPath, "finished writing markdown file");
3833
3806
  } catch (err) {
@@ -3857,7 +3830,7 @@ function builder5(argv) {
3857
3830
 
3858
3831
  // src/cmd/translate/index.ts
3859
3832
  var import_async5 = require("async");
3860
- var import_path32 = require("path");
3833
+ var import_path33 = require("path");
3861
3834
  var import_promises4 = require("fs/promises");
3862
3835
  var import_fast_xml_parser = require("fast-xml-parser");
3863
3836
  var import_session = require("@yandex-cloud/nodejs-sdk/dist/session");
@@ -3869,7 +3842,7 @@ var import_markdown_translation3 = __toESM(require("@diplodoc/markdown-translati
3869
3842
  var import_promises3 = require("fs/promises");
3870
3843
  var import_process3 = require("process");
3871
3844
  var import_os = require("os");
3872
- var import_path31 = require("path");
3845
+ var import_path32 = require("path");
3873
3846
  var YANDEX_OAUTH_TOKEN_FILENAME = ".ya_oauth_token";
3874
3847
  function getYandexOAuthToken() {
3875
3848
  return __async(this, null, function* () {
@@ -3880,7 +3853,7 @@ function getYandexOAuthToken() {
3880
3853
  function getYandexOAuthTokenFromHomeDir() {
3881
3854
  return __async(this, null, function* () {
3882
3855
  const error = "failed reading yandex oauth token";
3883
- const path = (0, import_path31.join)((0, import_os.homedir)(), YANDEX_OAUTH_TOKEN_FILENAME);
3856
+ const path = (0, import_path32.join)((0, import_os.homedir)(), YANDEX_OAUTH_TOKEN_FILENAME);
3884
3857
  let token;
3885
3858
  try {
3886
3859
  token = yield (0, import_promises3.readFile)(path, { encoding: "utf8" });
@@ -3949,7 +3922,7 @@ function handler5(args) {
3949
3922
  let found = [];
3950
3923
  ({
3951
3924
  state: { found }
3952
- } = yield glob((0, import_path32.join)(input, MD_GLOB3), {
3925
+ } = yield glob((0, import_path33.join)(input, MD_GLOB3), {
3953
3926
  nosort: true
3954
3927
  }));
3955
3928
  const oauthToken = yield getYandexOAuthToken();
@@ -3988,8 +3961,8 @@ function translator(params) {
3988
3961
  yandexCloudTranslateGlossaryPairs
3989
3962
  } = params;
3990
3963
  const session = new import_session.Session({ oauthToken });
3991
- const client3 = session.client(import_service_clients.TranslationServiceClient);
3992
- const request = (texts) => () => client3.translate(
3964
+ const client = session.client(import_service_clients.TranslationServiceClient);
3965
+ const request = (texts) => () => client.translate(
3993
3966
  import_translation_service.TranslateRequest.fromPartial({
3994
3967
  texts,
3995
3968
  folderId,
@@ -4006,7 +3979,7 @@ function translator(params) {
4006
3979
  return (mdPath) => __async(this, null, function* () {
4007
3980
  try {
4008
3981
  logger.info(mdPath, "translating");
4009
- const md = yield (0, import_promises4.readFile)((0, import_path32.resolve)(mdPath), { encoding: "utf-8" });
3982
+ const md = yield (0, import_promises4.readFile)((0, import_path33.resolve)(mdPath), { encoding: "utf-8" });
4010
3983
  const { xlf, skeleton } = import_markdown_translation3.default.extract({
4011
3984
  source: {
4012
3985
  language: sourceLanguage,
@@ -4064,7 +4037,7 @@ function translator(params) {
4064
4037
  skeleton
4065
4038
  });
4066
4039
  const outputPath = mdPath.replace(input, output);
4067
- yield (0, import_promises4.mkdir)((0, import_path32.dirname)(outputPath), { recursive: true });
4040
+ yield (0, import_promises4.mkdir)((0, import_path33.dirname)(outputPath), { recursive: true });
4068
4041
  yield (0, import_promises4.writeFile)(outputPath, composed);
4069
4042
  logger.info(outputPath, "finished translating");
4070
4043
  } catch (err) {
@@ -4127,7 +4100,7 @@ import_yargs.default.command(build).command(publish).command(xliff).command(tran
4127
4100
  default: false,
4128
4101
  describe: "Run in quiet mode. Don't write logs to stdout",
4129
4102
  type: "boolean"
4130
- }).group(["config", "strict", "quiet", "help", "version"], "Common options:").version(true ? "4.7.0" : "").help().parse((0, import_helpers.hideBin)(process.argv), {}, (err, { strict }, output) => {
4103
+ }).group(["config", "strict", "quiet", "help", "version"], "Common options:").version(true ? "4.8.0" : "").help().parse((0, import_helpers.hideBin)(process.argv), {}, (err, { strict }, output) => {
4131
4104
  console.timeEnd(MAIN_TIMER_ID);
4132
4105
  if (err) {
4133
4106
  console.error(err);