@diplodoc/cli 4.1.0 → 4.2.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.
Files changed (53) hide show
  1. package/build/app.client.css +2678 -41
  2. package/build/app.client.js +1 -1
  3. package/build/index.js +376 -267
  4. package/build/index.js.map +3 -3
  5. package/build/linter.js +54 -46
  6. package/build/linter.js.map +2 -2
  7. package/package.json +12 -11
  8. package/src/cmd/build/index.ts +29 -15
  9. package/src/cmd/publish/index.ts +1 -6
  10. package/src/cmd/publish/upload.ts +22 -16
  11. package/src/cmd/translate/index.ts +51 -37
  12. package/src/cmd/xliff/compose.ts +16 -7
  13. package/src/cmd/xliff/extract.ts +18 -9
  14. package/src/cmd/xliff/index.ts +4 -1
  15. package/src/constants.ts +4 -4
  16. package/src/index.ts +2 -2
  17. package/src/models.ts +12 -7
  18. package/src/resolvers/lintPage.ts +1 -7
  19. package/src/resolvers/md2html.ts +23 -15
  20. package/src/resolvers/md2md.ts +13 -13
  21. package/src/services/authors.ts +4 -2
  22. package/src/services/contributors.ts +26 -12
  23. package/src/services/includers/batteries/common.ts +14 -2
  24. package/src/services/includers/batteries/generic.ts +27 -9
  25. package/src/services/includers/batteries/sourcedocs.ts +4 -1
  26. package/src/services/includers/batteries/unarchive.ts +8 -4
  27. package/src/services/includers/index.ts +6 -4
  28. package/src/services/leading.ts +23 -26
  29. package/src/services/metadata.ts +35 -10
  30. package/src/services/preset.ts +2 -2
  31. package/src/services/tocs.ts +26 -21
  32. package/src/services/utils.ts +13 -3
  33. package/src/steps/processAssets.ts +2 -8
  34. package/src/steps/processExcludedFiles.ts +11 -20
  35. package/src/steps/processLinter.ts +8 -7
  36. package/src/steps/processLogs.ts +1 -6
  37. package/src/steps/processMapFile.ts +8 -11
  38. package/src/steps/processPages.ts +96 -66
  39. package/src/steps/processServiceFiles.ts +3 -1
  40. package/src/steps/publishFilesToS3.ts +16 -12
  41. package/src/utils/file.ts +5 -1
  42. package/src/utils/glob.ts +1 -3
  43. package/src/utils/markup.ts +28 -13
  44. package/src/utils/singlePage.ts +10 -9
  45. package/src/utils/toc.ts +20 -7
  46. package/src/utils/worker.ts +1 -1
  47. package/src/validator.ts +24 -16
  48. package/src/vcs-connector/client/github.ts +15 -7
  49. package/src/vcs-connector/connector-validator.ts +12 -6
  50. package/src/vcs-connector/github.ts +38 -11
  51. package/src/vcs-connector/index.ts +1 -1
  52. package/src/workers/linter/index.ts +1 -5
  53. package/CHANGELOG.md +0 -793
package/build/linter.js CHANGED
@@ -346,11 +346,7 @@ function getVarsPerRelativeFile(filePath) {
346
346
  var import_glob = __toESM(require("glob"));
347
347
  var glob = (pattern, options) => __async(void 0, null, function* () {
348
348
  return new Promise((res, rej) => {
349
- const state = (0, import_glob.default)(
350
- pattern,
351
- options,
352
- (err) => err ? rej(err) : res({ state })
353
- );
349
+ const state = (0, import_glob.default)(pattern, options, (err) => err ? rej(err) : res({ state }));
354
350
  });
355
351
  });
356
352
 
@@ -447,7 +443,14 @@ var MD_GLOB = "**/*.md";
447
443
  function includerFunction(params) {
448
444
  return __async(this, null, function* () {
449
445
  var _a, _b;
450
- const { readBasePath, writeBasePath, tocPath, item, passedParams: { input, leadingPage }, index } = params;
446
+ const {
447
+ readBasePath,
448
+ writeBasePath,
449
+ tocPath,
450
+ item,
451
+ passedParams: { input, leadingPage },
452
+ index
453
+ } = params;
451
454
  if (!(input == null ? void 0 : input.length) || !((_a = item.include) == null ? void 0 : _a.path)) {
452
455
  throw new GenericIncluderError("provide includer with input parameter", tocPath);
453
456
  }
@@ -457,7 +460,9 @@ function includerFunction(params) {
457
460
  const contentPath = index === 0 ? (0, import_path9.join)(writeBasePath, tocDirPath, input) : (0, import_path9.join)(readBasePath, tocDirPath, input);
458
461
  let cache = {};
459
462
  let found = [];
460
- ({ state: { found, cache } } = yield glob(MD_GLOB, {
463
+ ({
464
+ state: { found, cache }
465
+ } = yield glob(MD_GLOB, {
461
466
  cwd: contentPath,
462
467
  nosort: true,
463
468
  nocase: true,
@@ -489,9 +494,14 @@ function createGraphFromPaths(paths) {
489
494
  continue;
490
495
  }
491
496
  const file = chunks.pop();
492
- (0, import_lodash2.updateWith)(graph, chunks, (old) => {
493
- return old ? { files: [...old.files, file] } : { files: [file] };
494
- }, Object);
497
+ (0, import_lodash2.updateWith)(
498
+ graph,
499
+ chunks,
500
+ (old) => {
501
+ return old ? { files: [...old.files, file] } : { files: [file] };
502
+ },
503
+ Object
504
+ );
495
505
  }
496
506
  return graph;
497
507
  }
@@ -533,8 +543,11 @@ var usage = `include:
533
543
  `;
534
544
  function includerFunction2(params) {
535
545
  return __async(this, null, function* () {
536
- logger.warn(params.tocPath, `sourcedocs inlcuder is getting depricated in favor of generic includer
537
- ${usage}`);
546
+ logger.warn(
547
+ params.tocPath,
548
+ `sourcedocs inlcuder is getting depricated in favor of generic includer
549
+ ${usage}`
550
+ );
538
551
  yield generic_default.includerFunction(params);
539
552
  });
540
553
  }
@@ -593,7 +606,13 @@ function pipeline(readPath, writeBasePath) {
593
606
  }
594
607
  function includerFunction3(params) {
595
608
  return __async(this, null, function* () {
596
- const { readBasePath, writeBasePath, tocPath, passedParams: { input, output }, index } = params;
609
+ const {
610
+ readBasePath,
611
+ writeBasePath,
612
+ tocPath,
613
+ passedParams: { input, output },
614
+ index
615
+ } = params;
597
616
  if (!(input == null ? void 0 : input.length) || !(output == null ? void 0 : output.length)) {
598
617
  throw new UnarchiveIncluderError("provide includer with input parameter", tocPath);
599
618
  }
@@ -735,11 +754,9 @@ function add(path) {
735
754
  }
736
755
  const combinedVars = __spreadValues(__spreadValues({}, preset_default.get(pathToDir)), vars);
737
756
  if (parsedToc.title) {
738
- parsedToc.title = firstFilterTextItems(
739
- parsedToc.title,
740
- combinedVars,
741
- { resolveConditions: true }
742
- );
757
+ parsedToc.title = firstFilterTextItems(parsedToc.title, combinedVars, {
758
+ resolveConditions: true
759
+ });
743
760
  }
744
761
  if (typeof parsedToc.title === "string") {
745
762
  parsedToc.title = liquidField(parsedToc.title, combinedVars, path);
@@ -764,10 +781,7 @@ function add(path) {
764
781
  }
765
782
  function processTocItems(path, items, tocDir, sourcesDir, vars) {
766
783
  return __async(this, null, function* () {
767
- const {
768
- resolveConditions,
769
- removeHiddenTocItems
770
- } = argv_default.getConfig();
784
+ const { resolveConditions, removeHiddenTocItems } = argv_default.getConfig();
771
785
  let preparedItems = items;
772
786
  if (resolveConditions || removeHiddenTocItems) {
773
787
  try {
@@ -910,9 +924,19 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
910
924
  addIncludeTocPath(includeTocPath);
911
925
  let includedTocItems = (item.items || []).concat(includeToc.items);
912
926
  const baseTocDir = mode === "link" /* LINK */ ? includeTocDir : tocDir;
913
- includedTocItems = yield processTocItems(path, includedTocItems, baseTocDir, sourcesDir, vars);
927
+ includedTocItems = yield processTocItems(
928
+ path,
929
+ includedTocItems,
930
+ baseTocDir,
931
+ sourcesDir,
932
+ vars
933
+ );
914
934
  if (mode === "link" /* LINK */) {
915
- includedTocItems = _replaceIncludesHrefs(includedTocItems, includeTocDir, tocDir);
935
+ includedTocItems = _replaceIncludesHrefs(
936
+ includedTocItems,
937
+ includeTocDir,
938
+ tocDir
939
+ );
916
940
  }
917
941
  if (item.name) {
918
942
  item.items = includedTocItems;
@@ -920,7 +944,9 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
920
944
  includedInlineItems = includedTocItems;
921
945
  }
922
946
  } catch (err) {
923
- const message = `Error while including toc: ${(0, import_chalk2.bold)(includeTocPath)} to ${(0, import_chalk2.bold)((0, import_path12.join)(tocDir, "toc.yaml"))}`;
947
+ const message = `Error while including toc: ${(0, import_chalk2.bold)(includeTocPath)} to ${(0, import_chalk2.bold)(
948
+ (0, import_path12.join)(tocDir, "toc.yaml")
949
+ )}`;
924
950
  import_log2.default.error(message);
925
951
  continue;
926
952
  } finally {
@@ -1106,11 +1132,7 @@ var import_shelljs3 = __toESM(require("shelljs"));
1106
1132
  var import_log4 = __toESM(require("@diplodoc/transform/lib/log"));
1107
1133
  var import_liquid3 = __toESM(require("@diplodoc/transform/lib/liquid"));
1108
1134
  function liquidMd2Md(input, vars, path) {
1109
- const {
1110
- applyPresets,
1111
- resolveConditions,
1112
- conditionsInCode
1113
- } = argv_default.getConfig();
1135
+ const { applyPresets, resolveConditions, conditionsInCode } = argv_default.getConfig();
1114
1136
  return (0, import_liquid3.default)(input, vars, path, {
1115
1137
  conditions: resolveConditions,
1116
1138
  substitutions: applyPresets,
@@ -1165,17 +1187,7 @@ function lintPage(options) {
1165
1187
  }
1166
1188
  }
1167
1189
  function MdFileLinter(content, lintOptions) {
1168
- const _a = argv_default.getConfig(), {
1169
- input,
1170
- lintConfig,
1171
- disableLiquid,
1172
- outputFormat
1173
- } = _a, options = __objRest(_a, [
1174
- "input",
1175
- "lintConfig",
1176
- "disableLiquid",
1177
- "outputFormat"
1178
- ]);
1190
+ const _a = argv_default.getConfig(), { input, lintConfig, disableLiquid, outputFormat } = _a, options = __objRest(_a, ["input", "lintConfig", "disableLiquid", "outputFormat"]);
1179
1191
  const { path: filePath } = lintOptions;
1180
1192
  const plugins2 = outputFormat === "md" ? [] : plugins_exports.getPlugins();
1181
1193
  const vars = getVarsPerFile(filePath);
@@ -1227,11 +1239,7 @@ function MdFileLinter(content, lintOptions) {
1227
1239
  // src/workers/linter/index.ts
1228
1240
  var processedPages = new import_observable.Subject();
1229
1241
  function run(_0) {
1230
- return __async(this, arguments, function* ({
1231
- argvConfig,
1232
- presetStorage: presetStorage2,
1233
- navigationPaths: navigationPaths2
1234
- }) {
1242
+ return __async(this, arguments, function* ({ argvConfig, presetStorage: presetStorage2, navigationPaths: navigationPaths2 }) {
1235
1243
  argv_default.set(argvConfig);
1236
1244
  preset_default.setPresetStorage(presetStorage2);
1237
1245
  tocs_default.setNavigationPaths(navigationPaths2);