@diplodoc/cli 4.2.0 → 4.2.2-beta.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/linter.js CHANGED
@@ -121,7 +121,7 @@ var import_threads = require("threads");
121
121
 
122
122
  // src/services/tocs.ts
123
123
  var import_path12 = require("path");
124
- var import_fs3 = require("fs");
124
+ var import_fs2 = require("fs");
125
125
  var import_js_yaml3 = require("js-yaml");
126
126
  var import_shelljs2 = __toESM(require("shelljs"));
127
127
  var import_walk_sync = __toESM(require("walk-sync"));
@@ -353,7 +353,6 @@ var glob = (pattern, options) => __async(void 0, null, function* () {
353
353
  // src/utils/file.ts
354
354
  var import_path6 = require("path");
355
355
  var import_shelljs = __toESM(require("shelljs"));
356
- var import_fs = require("fs");
357
356
 
358
357
  // src/services/contributors.ts
359
358
  var import_promises = require("fs/promises");
@@ -560,7 +559,7 @@ __export(unarchive_exports, {
560
559
  includerFunction: () => includerFunction3,
561
560
  name: () => name3
562
561
  });
563
- var import_fs2 = require("fs");
562
+ var import_fs = require("fs");
564
563
  var import_path10 = require("path");
565
564
  var import_tar_stream = require("tar-stream");
566
565
  var name3 = "unarchive";
@@ -573,7 +572,7 @@ var UnarchiveIncluderError = class extends Error {
573
572
  };
574
573
  function pipeline(readPath, writeBasePath) {
575
574
  return new Promise((res, rej) => {
576
- const reader = (0, import_fs2.createReadStream)(readPath);
575
+ const reader = (0, import_fs.createReadStream)(readPath);
577
576
  reader.on("error", (err) => {
578
577
  rej(err);
579
578
  });
@@ -581,14 +580,14 @@ function pipeline(readPath, writeBasePath) {
581
580
  extractor.on("error", (err) => {
582
581
  rej(err);
583
582
  });
584
- (0, import_fs2.mkdirSync)(writeBasePath, { recursive: true });
583
+ (0, import_fs.mkdirSync)(writeBasePath, { recursive: true });
585
584
  extractor.on("entry", (header, stream, next) => {
586
585
  const { type, name: name4 } = header;
587
586
  const writePath = (0, import_path10.join)(writeBasePath, name4);
588
587
  const writeDirPath = type === "directory" ? writePath : (0, import_path10.dirname)(writePath);
589
- (0, import_fs2.mkdirSync)(writeDirPath, { recursive: true });
588
+ (0, import_fs.mkdirSync)(writeDirPath, { recursive: true });
590
589
  if (type !== "directory") {
591
- const writer = (0, import_fs2.createWriteStream)(writePath, { flags: "w" });
590
+ const writer = (0, import_fs.createWriteStream)(writePath, { flags: "w" });
592
591
  writer.on("error", (err) => {
593
592
  rej(err);
594
593
  });
@@ -747,7 +746,7 @@ function add(path) {
747
746
  vars
748
747
  } = argv_default.getConfig();
749
748
  const pathToDir = (0, import_path12.dirname)(path);
750
- const content = (0, import_fs3.readFileSync)((0, import_path12.resolve)(inputFolderPath, path), "utf8");
749
+ const content = (0, import_fs2.readFileSync)((0, import_path12.resolve)(inputFolderPath, path), "utf8");
751
750
  const parsedToc = (0, import_js_yaml3.load)(content);
752
751
  if (parsedToc.stage === ignoreStage) {
753
752
  return;
@@ -774,7 +773,7 @@ function add(path) {
774
773
  const outputPath = (0, import_path12.resolve)(outputFolderPath, path);
775
774
  const outputToc = (0, import_js_yaml3.dump)(parsedToc);
776
775
  import_shelljs2.default.mkdir("-p", (0, import_path12.dirname)(outputPath));
777
- (0, import_fs3.writeFileSync)(outputPath, outputToc);
776
+ (0, import_fs2.writeFileSync)(outputPath, outputToc);
778
777
  }
779
778
  prepareNavigationPaths(parsedToc, pathToDir);
780
779
  });
@@ -850,16 +849,16 @@ function _copyTocDir(tocPath, destDir) {
850
849
  const isMdFile = fileExtension === ".md";
851
850
  import_shelljs2.default.mkdir("-p", (0, import_path12.parse)(to).dir);
852
851
  if (isMdFile) {
853
- const fileContent = (0, import_fs3.readFileSync)(from, "utf8");
852
+ const fileContent = (0, import_fs2.readFileSync)(from, "utf8");
854
853
  const sourcePath = (0, import_path12.relative)(inputFolderPath, from);
855
854
  const updatedFileContent = getContentWithUpdatedStaticMetadata({
856
855
  fileContent,
857
856
  sourcePath,
858
857
  addSourcePath: true
859
858
  });
860
- (0, import_fs3.writeFileSync)(to, updatedFileContent);
859
+ (0, import_fs2.writeFileSync)(to, updatedFileContent);
861
860
  } else {
862
- (0, import_fs3.copyFileSync)(from, to);
861
+ import_shelljs2.default.cp(from, to);
863
862
  }
864
863
  });
865
864
  }
@@ -914,7 +913,7 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
914
913
  const includeTocPath = mode === "root_merge" /* ROOT_MERGE */ ? (0, import_path12.resolve)(sourcesDir, item.include.path) : (0, import_path12.resolve)(tocDir, item.include.path);
915
914
  const includeTocDir = (0, import_path12.dirname)(includeTocPath);
916
915
  try {
917
- const includeToc = (0, import_js_yaml3.load)((0, import_fs3.readFileSync)(includeTocPath, "utf8"));
916
+ const includeToc = (0, import_js_yaml3.load)((0, import_fs2.readFileSync)(includeTocPath, "utf8"));
918
917
  if (includeToc.stage === "tech-preview" /* TECH_PREVIEW */) {
919
918
  continue;
920
919
  }
@@ -971,7 +970,7 @@ function getTocDir(pagePath) {
971
970
  if (!tocDir.includes(inputFolderPath)) {
972
971
  throw new Error("Error while finding toc dir");
973
972
  }
974
- if ((0, import_fs3.existsSync)(tocPath)) {
973
+ if ((0, import_fs2.existsSync)(tocPath)) {
975
974
  return tocDir;
976
975
  }
977
976
  return getTocDir(tocDir);
@@ -1022,7 +1021,7 @@ var preset_default = {
1022
1021
 
1023
1022
  // src/services/argv.ts
1024
1023
  var import_path14 = require("path");
1025
- var import_fs4 = require("fs");
1024
+ var import_fs3 = require("fs");
1026
1025
  var _argv;
1027
1026
  function getConfig() {
1028
1027
  return _argv;
@@ -1035,7 +1034,7 @@ function init2(argv) {
1035
1034
  _argv.vars = JSON.parse(argv.vars);
1036
1035
  }
1037
1036
  try {
1038
- const ignorefile = (0, import_fs4.readFileSync)((0, import_path14.join)(_argv.rootInput, ".yfmignore"), "utf8");
1037
+ const ignorefile = (0, import_fs3.readFileSync)((0, import_path14.join)(_argv.rootInput, ".yfmignore"), "utf8");
1039
1038
  const ignore = ignorefile.split("\n");
1040
1039
  _argv.ignore = _argv.ignore.concat(ignore);
1041
1040
  } catch (e) {
@@ -1052,7 +1051,7 @@ var argv_default = {
1052
1051
 
1053
1052
  // src/services/leading.ts
1054
1053
  var import_path15 = require("path");
1055
- var import_fs5 = require("fs");
1054
+ var import_fs4 = require("fs");
1056
1055
  var import_js_yaml4 = require("js-yaml");
1057
1056
  var import_log3 = __toESM(require("@diplodoc/transform/lib/log"));
1058
1057
 
@@ -1126,7 +1125,7 @@ function getDefaultLintConfig() {
1126
1125
  }
1127
1126
 
1128
1127
  // src/resolvers/md2md.ts
1129
- var import_fs6 = require("fs");
1128
+ var import_fs5 = require("fs");
1130
1129
  var import_path16 = require("path");
1131
1130
  var import_shelljs3 = __toESM(require("shelljs"));
1132
1131
  var import_log4 = __toESM(require("@diplodoc/transform/lib/log"));
@@ -1144,7 +1143,7 @@ function liquidMd2Md(input, vars, path) {
1144
1143
 
1145
1144
  // src/resolvers/md2html.ts
1146
1145
  var import_path17 = require("path");
1147
- var import_fs7 = require("fs");
1146
+ var import_fs6 = require("fs");
1148
1147
  var import_js_yaml5 = __toESM(require("js-yaml"));
1149
1148
  var import_transform = __toESM(require("@diplodoc/transform"));
1150
1149
  var import_log5 = __toESM(require("@diplodoc/transform/lib/log"));
@@ -1161,7 +1160,7 @@ function liquidMd2Html(input, vars, path) {
1161
1160
  var import_path18 = require("path");
1162
1161
  var import_log6 = __toESM(require("@diplodoc/transform/lib/log"));
1163
1162
  var import_yfmlint = __toESM(require("@diplodoc/transform/lib/yfmlint"));
1164
- var import_fs8 = require("fs");
1163
+ var import_fs7 = require("fs");
1165
1164
  var import_chalk3 = require("chalk");
1166
1165
  var FileLinter = {
1167
1166
  ".md": MdFileLinter
@@ -1171,7 +1170,7 @@ function lintPage(options) {
1171
1170
  const { input } = argv_default.getConfig();
1172
1171
  const resolvedPath = (0, import_path18.resolve)(input, inputPath);
1173
1172
  try {
1174
- const content = (0, import_fs8.readFileSync)(resolvedPath, "utf8");
1173
+ const content = (0, import_fs7.readFileSync)(resolvedPath, "utf8");
1175
1174
  const lintFn = FileLinter[fileExtension];
1176
1175
  if (!lintFn) {
1177
1176
  return;