@diplodoc/cli 4.13.2 → 4.13.4
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/assets/vendor.css +16 -1
- package/assets/vendor.js +1 -1
- package/build/index.js +105 -83
- package/build/index.js.map +3 -3
- package/build/linter.js +66 -87
- package/build/linter.js.map +4 -4
- package/package.json +5 -8
- package/src/cmd/translate/index.ts +131 -92
package/build/linter.js
CHANGED
|
@@ -56,7 +56,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
56
56
|
));
|
|
57
57
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
58
|
var __async = (__this, __arguments, generator) => {
|
|
59
|
-
return new Promise((
|
|
59
|
+
return new Promise((resolve5, reject) => {
|
|
60
60
|
var fulfilled = (value) => {
|
|
61
61
|
try {
|
|
62
62
|
step(generator.next(value));
|
|
@@ -71,7 +71,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
71
71
|
reject(e);
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
var step = (x) => x.done ?
|
|
74
|
+
var step = (x) => x.done ? resolve5(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
75
75
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
76
76
|
});
|
|
77
77
|
};
|
|
@@ -80,12 +80,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
80
80
|
var linter_exports = {};
|
|
81
81
|
module.exports = __toCommonJS(linter_exports);
|
|
82
82
|
var import_log7 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
83
|
-
var
|
|
83
|
+
var import_path10 = require("path");
|
|
84
84
|
var import_observable = require("threads/observable");
|
|
85
85
|
var import_threads = require("threads");
|
|
86
86
|
|
|
87
87
|
// src/services/tocs.ts
|
|
88
|
-
var
|
|
88
|
+
var import_path6 = require("path");
|
|
89
89
|
var import_fs2 = require("fs");
|
|
90
90
|
var import_js_yaml3 = require("js-yaml");
|
|
91
91
|
var import_shelljs2 = __toESM(require("shelljs"));
|
|
@@ -133,7 +133,6 @@ var logger = {
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
// src/utils/markup.ts
|
|
136
|
-
var import_path3 = require("path");
|
|
137
136
|
var import_process = require("process");
|
|
138
137
|
|
|
139
138
|
// src/constants.ts
|
|
@@ -197,9 +196,7 @@ var metadataBorder = "---";
|
|
|
197
196
|
|
|
198
197
|
// src/utils/singlePage.ts
|
|
199
198
|
var import_node_html_parser = require("node-html-parser");
|
|
200
|
-
var import_path2 = require("path");
|
|
201
199
|
var import_utilsFS = require("@diplodoc/transform/lib/utilsFS");
|
|
202
|
-
var import_url = __toESM(require("url"));
|
|
203
200
|
var import_escapeRegExp = __toESM(require("lodash/escapeRegExp"));
|
|
204
201
|
|
|
205
202
|
// src/utils/url.ts
|
|
@@ -213,12 +210,6 @@ var import_manifest = __toESM(require("@diplodoc/client/manifest"));
|
|
|
213
210
|
var import_html_escaper = require("html-escaper");
|
|
214
211
|
var \u0441arriage = import_process.platform === "win32" /* WINDOWS */ ? "\r\n" : "\n";
|
|
215
212
|
|
|
216
|
-
// src/utils/path.ts
|
|
217
|
-
var import_path4 = require("path");
|
|
218
|
-
|
|
219
|
-
// src/utils/toc.ts
|
|
220
|
-
var import_path5 = require("path");
|
|
221
|
-
|
|
222
213
|
// src/services/utils.ts
|
|
223
214
|
var import_evaluation = __toESM(require("@diplodoc/transform/lib/liquid/evaluation"));
|
|
224
215
|
var import_liquid = __toESM(require("@diplodoc/transform/lib/liquid"));
|
|
@@ -302,16 +293,16 @@ function isObject(o) {
|
|
|
302
293
|
}
|
|
303
294
|
|
|
304
295
|
// src/utils/presets.ts
|
|
305
|
-
var
|
|
296
|
+
var import_path2 = require("path");
|
|
306
297
|
function getVarsPerFile(filePath) {
|
|
307
298
|
const { vars: argVars } = argv_default.getConfig();
|
|
308
|
-
const result = __spreadValues(__spreadValues({}, preset_default.get((0,
|
|
299
|
+
const result = __spreadValues(__spreadValues({}, preset_default.get((0, import_path2.dirname)(filePath))), argVars);
|
|
309
300
|
return result;
|
|
310
301
|
}
|
|
311
302
|
function getVarsPerRelativeFile(filePath) {
|
|
312
303
|
const { input } = argv_default.getConfig();
|
|
313
|
-
const root = (0,
|
|
314
|
-
const relativeFilePath = (0,
|
|
304
|
+
const root = (0, import_path2.resolve)(input);
|
|
305
|
+
const relativeFilePath = (0, import_path2.relative)(root, filePath);
|
|
315
306
|
return getVarsPerFile(relativeFilePath);
|
|
316
307
|
}
|
|
317
308
|
|
|
@@ -324,15 +315,9 @@ var glob = (pattern, options) => __async(void 0, null, function* () {
|
|
|
324
315
|
});
|
|
325
316
|
|
|
326
317
|
// src/utils/file.ts
|
|
327
|
-
var import_path7 = require("path");
|
|
328
318
|
var import_shelljs = __toESM(require("shelljs"));
|
|
329
319
|
|
|
330
|
-
// src/services/contributors.ts
|
|
331
|
-
var import_promises = require("fs/promises");
|
|
332
|
-
var import_path8 = require("path");
|
|
333
|
-
|
|
334
320
|
// src/services/metadata.ts
|
|
335
|
-
var import_path9 = require("path");
|
|
336
321
|
function getContentWithUpdatedStaticMetadata({
|
|
337
322
|
fileContent,
|
|
338
323
|
sourcePath,
|
|
@@ -402,7 +387,7 @@ __export(includers_exports, {
|
|
|
402
387
|
applyIncluders: () => applyIncluders,
|
|
403
388
|
init: () => init
|
|
404
389
|
});
|
|
405
|
-
var
|
|
390
|
+
var import_path5 = require("path");
|
|
406
391
|
var import_lodash2 = require("lodash");
|
|
407
392
|
|
|
408
393
|
// src/services/includers/batteries/generic.ts
|
|
@@ -412,8 +397,8 @@ __export(generic_exports, {
|
|
|
412
397
|
includerFunction: () => includerFunction,
|
|
413
398
|
name: () => name
|
|
414
399
|
});
|
|
415
|
-
var
|
|
416
|
-
var
|
|
400
|
+
var import_promises = require("fs/promises");
|
|
401
|
+
var import_path3 = require("path");
|
|
417
402
|
var import_lodash = require("lodash");
|
|
418
403
|
var import_js_yaml2 = require("js-yaml");
|
|
419
404
|
var GenericIncluderError = class extends Error {
|
|
@@ -441,8 +426,8 @@ function includerFunction(params) {
|
|
|
441
426
|
}
|
|
442
427
|
try {
|
|
443
428
|
const leadingPageName = (_b = leadingPage == null ? void 0 : leadingPage.name) != null ? _b : "Overview";
|
|
444
|
-
const tocDirPath = (0,
|
|
445
|
-
const contentPath = index === 0 ? (0,
|
|
429
|
+
const tocDirPath = (0, import_path3.dirname)(tocPath);
|
|
430
|
+
const contentPath = index === 0 ? (0, import_path3.join)(writeBasePath, tocDirPath, input) : (0, import_path3.join)(readBasePath, tocDirPath, input);
|
|
446
431
|
let cache = {};
|
|
447
432
|
let found = [];
|
|
448
433
|
({
|
|
@@ -453,16 +438,16 @@ function includerFunction(params) {
|
|
|
453
438
|
nocase: true,
|
|
454
439
|
cache
|
|
455
440
|
}));
|
|
456
|
-
const writePath = (0,
|
|
457
|
-
yield (0,
|
|
441
|
+
const writePath = (0, import_path3.join)(writeBasePath, tocDirPath, item.include.path);
|
|
442
|
+
yield (0, import_promises.mkdir)(writePath, { recursive: true });
|
|
458
443
|
for (const filePath of found) {
|
|
459
|
-
const file = yield (0,
|
|
460
|
-
yield (0,
|
|
461
|
-
yield (0,
|
|
444
|
+
const file = yield (0, import_promises.readFile)((0, import_path3.join)(contentPath, filePath));
|
|
445
|
+
yield (0, import_promises.mkdir)((0, import_path3.dirname)((0, import_path3.join)(writePath, filePath)), { recursive: true });
|
|
446
|
+
yield (0, import_promises.writeFile)((0, import_path3.join)(writePath, filePath), file);
|
|
462
447
|
}
|
|
463
448
|
const graph = createGraphFromPaths(found);
|
|
464
449
|
const toc = createToc(leadingPageName, item.include.path)(graph, []);
|
|
465
|
-
yield (0,
|
|
450
|
+
yield (0, import_promises.writeFile)((0, import_path3.join)(writePath, "toc.yaml"), (0, import_js_yaml2.dump)(toc));
|
|
466
451
|
} catch (err) {
|
|
467
452
|
throw new GenericIncluderError(err.toString(), tocPath);
|
|
468
453
|
}
|
|
@@ -494,8 +479,8 @@ function createToc(leadingPageName, tocName) {
|
|
|
494
479
|
return function createTocRec(graph, cursor) {
|
|
495
480
|
var _a, _b;
|
|
496
481
|
const handler = (file) => ({
|
|
497
|
-
name: (0,
|
|
498
|
-
href: (0,
|
|
482
|
+
name: (0, import_path3.parse)(file).name === "index" ? leadingPageName : file,
|
|
483
|
+
href: (0, import_path3.join)(...cursor, file)
|
|
499
484
|
});
|
|
500
485
|
const recurse = (key) => createTocRec(graph[key], [...cursor, key]);
|
|
501
486
|
const current = {
|
|
@@ -546,7 +531,7 @@ __export(unarchive_exports, {
|
|
|
546
531
|
name: () => name3
|
|
547
532
|
});
|
|
548
533
|
var import_fs = require("fs");
|
|
549
|
-
var
|
|
534
|
+
var import_path4 = require("path");
|
|
550
535
|
var import_tar_stream = require("tar-stream");
|
|
551
536
|
var name3 = "unarchive";
|
|
552
537
|
var UnarchiveIncluderError = class extends Error {
|
|
@@ -569,8 +554,8 @@ function pipeline(readPath, writeBasePath) {
|
|
|
569
554
|
(0, import_fs.mkdirSync)(writeBasePath, { recursive: true });
|
|
570
555
|
extractor.on("entry", (header, stream, next) => {
|
|
571
556
|
const { type, name: name4 } = header;
|
|
572
|
-
const writePath = (0,
|
|
573
|
-
const writeDirPath = type === "directory" ? writePath : (0,
|
|
557
|
+
const writePath = (0, import_path4.join)(writeBasePath, name4);
|
|
558
|
+
const writeDirPath = type === "directory" ? writePath : (0, import_path4.dirname)(writePath);
|
|
574
559
|
(0, import_fs.mkdirSync)(writeDirPath, { recursive: true });
|
|
575
560
|
if (type !== "directory") {
|
|
576
561
|
const writer = (0, import_fs.createWriteStream)(writePath, { flags: "w" });
|
|
@@ -601,8 +586,8 @@ function includerFunction3(params) {
|
|
|
601
586
|
if (!(input == null ? void 0 : input.length) || !(output == null ? void 0 : output.length)) {
|
|
602
587
|
throw new UnarchiveIncluderError("provide includer with input parameter", tocPath);
|
|
603
588
|
}
|
|
604
|
-
const contentPath = index === 0 ? (0,
|
|
605
|
-
const writePath = (0,
|
|
589
|
+
const contentPath = index === 0 ? (0, import_path4.join)(writeBasePath, input) : (0, import_path4.join)(readBasePath, input);
|
|
590
|
+
const writePath = (0, import_path4.join)(writeBasePath, output);
|
|
606
591
|
try {
|
|
607
592
|
yield pipeline(contentPath, writePath);
|
|
608
593
|
} catch (err) {
|
|
@@ -659,7 +644,7 @@ function applyIncluders(path, item, vars) {
|
|
|
659
644
|
const passedParams = __spreadValues({}, rest);
|
|
660
645
|
yield applyIncluder({ path, item, includer, passedParams, index, vars });
|
|
661
646
|
}
|
|
662
|
-
item.include.path = (0,
|
|
647
|
+
item.include.path = (0, import_path5.join)(item.include.path, "toc.yaml");
|
|
663
648
|
index++;
|
|
664
649
|
});
|
|
665
650
|
}
|
|
@@ -732,8 +717,8 @@ function add(path) {
|
|
|
732
717
|
ignoreStage,
|
|
733
718
|
vars
|
|
734
719
|
} = argv_default.getConfig();
|
|
735
|
-
const pathToDir = (0,
|
|
736
|
-
const content = (0, import_fs2.readFileSync)((0,
|
|
720
|
+
const pathToDir = (0, import_path6.dirname)(path);
|
|
721
|
+
const content = (0, import_fs2.readFileSync)((0, import_path6.resolve)(inputFolderPath, path), "utf8");
|
|
737
722
|
const parsedToc = (0, import_js_yaml3.load)(content);
|
|
738
723
|
if (parsedToc.stage === ignoreStage) {
|
|
739
724
|
return;
|
|
@@ -750,16 +735,16 @@ function add(path) {
|
|
|
750
735
|
parsedToc.items = yield processTocItems(
|
|
751
736
|
path,
|
|
752
737
|
parsedToc.items,
|
|
753
|
-
(0,
|
|
754
|
-
(0,
|
|
738
|
+
(0, import_path6.join)(inputFolderPath, pathToDir),
|
|
739
|
+
(0, import_path6.resolve)(inputFolderPath),
|
|
755
740
|
combinedVars
|
|
756
741
|
);
|
|
757
742
|
storage.set(path, parsedToc);
|
|
758
743
|
parsedToc.base = pathToDir;
|
|
759
744
|
if (outputFormat === "md") {
|
|
760
|
-
const outputPath = (0,
|
|
745
|
+
const outputPath = (0, import_path6.resolve)(outputFolderPath, path);
|
|
761
746
|
const outputToc = (0, import_js_yaml3.dump)(parsedToc);
|
|
762
|
-
import_shelljs2.default.mkdir("-p", (0,
|
|
747
|
+
import_shelljs2.default.mkdir("-p", (0, import_path6.dirname)(outputPath));
|
|
763
748
|
(0, import_fs2.writeFileSync)(outputPath, outputToc);
|
|
764
749
|
}
|
|
765
750
|
prepareNavigationPaths(parsedToc, pathToDir);
|
|
@@ -802,7 +787,7 @@ function prepareNavigationPaths(parsedToc, dirPath) {
|
|
|
802
787
|
processItems(preparedSubItems, pathToDir);
|
|
803
788
|
}
|
|
804
789
|
if (item.href && !isExternalHref(item.href)) {
|
|
805
|
-
const href = (0,
|
|
790
|
+
const href = (0, import_path6.join)(pathToDir, item.href);
|
|
806
791
|
storage.set(href, parsedToc);
|
|
807
792
|
const navigationPath = _normalizeHref(href);
|
|
808
793
|
navigationPaths.push(navigationPath);
|
|
@@ -812,32 +797,32 @@ function prepareNavigationPaths(parsedToc, dirPath) {
|
|
|
812
797
|
processItems([parsedToc], dirPath);
|
|
813
798
|
}
|
|
814
799
|
function _normalizeHref(href) {
|
|
815
|
-
const preparedHref = (0,
|
|
800
|
+
const preparedHref = (0, import_path6.normalize)(href);
|
|
816
801
|
if (preparedHref.endsWith(".md") || preparedHref.endsWith(".yaml")) {
|
|
817
802
|
return preparedHref;
|
|
818
803
|
}
|
|
819
|
-
if (preparedHref.endsWith(
|
|
804
|
+
if (preparedHref.endsWith(import_path6.sep)) {
|
|
820
805
|
return `${preparedHref}index.yaml`;
|
|
821
806
|
}
|
|
822
807
|
return `${preparedHref}.md`;
|
|
823
808
|
}
|
|
824
809
|
function _copyTocDir(tocPath, destDir) {
|
|
825
810
|
const { input: inputFolderPath } = argv_default.getConfig();
|
|
826
|
-
const { dir: tocDir } = (0,
|
|
811
|
+
const { dir: tocDir } = (0, import_path6.parse)(tocPath);
|
|
827
812
|
const files = (0, import_walk_sync.default)(tocDir, {
|
|
828
813
|
globs: ["**/*.*"],
|
|
829
814
|
ignore: ["**/toc.yaml"],
|
|
830
815
|
directories: false
|
|
831
816
|
});
|
|
832
817
|
files.forEach((relPath) => {
|
|
833
|
-
const from = (0,
|
|
834
|
-
const to = (0,
|
|
835
|
-
const fileExtension = (0,
|
|
818
|
+
const from = (0, import_path6.resolve)(tocDir, relPath);
|
|
819
|
+
const to = (0, import_path6.resolve)(destDir, relPath);
|
|
820
|
+
const fileExtension = (0, import_path6.extname)(relPath);
|
|
836
821
|
const isMdFile = fileExtension === ".md";
|
|
837
|
-
import_shelljs2.default.mkdir("-p", (0,
|
|
822
|
+
import_shelljs2.default.mkdir("-p", (0, import_path6.parse)(to).dir);
|
|
838
823
|
if (isMdFile) {
|
|
839
824
|
const fileContent = (0, import_fs2.readFileSync)(from, "utf8");
|
|
840
|
-
const sourcePath = (0,
|
|
825
|
+
const sourcePath = (0, import_path6.relative)(inputFolderPath, from);
|
|
841
826
|
const updatedFileContent = getContentWithUpdatedStaticMetadata({
|
|
842
827
|
fileContent,
|
|
843
828
|
sourcePath,
|
|
@@ -847,22 +832,22 @@ function _copyTocDir(tocPath, destDir) {
|
|
|
847
832
|
} else {
|
|
848
833
|
import_shelljs2.default.cp(from, to);
|
|
849
834
|
}
|
|
850
|
-
const relFrom = (0,
|
|
851
|
-
const relTo = (0,
|
|
835
|
+
const relFrom = (0, import_path6.relative)(inputFolderPath, from);
|
|
836
|
+
const relTo = (0, import_path6.relative)(inputFolderPath, to);
|
|
852
837
|
tocFileCopyMap.set(relTo, relFrom);
|
|
853
838
|
});
|
|
854
839
|
}
|
|
855
840
|
function _replaceIncludesHrefs(items, includeTocDir, tocDir) {
|
|
856
841
|
return items.reduce((acc, tocItem) => {
|
|
857
842
|
if (tocItem.href) {
|
|
858
|
-
tocItem.href = (0,
|
|
843
|
+
tocItem.href = (0, import_path6.relative)(tocDir, (0, import_path6.resolve)(includeTocDir, tocItem.href));
|
|
859
844
|
}
|
|
860
845
|
if (tocItem.items) {
|
|
861
846
|
tocItem.items = _replaceIncludesHrefs(tocItem.items, includeTocDir, tocDir);
|
|
862
847
|
}
|
|
863
848
|
if (tocItem.include) {
|
|
864
849
|
const { path } = tocItem.include;
|
|
865
|
-
tocItem.include.path = (0,
|
|
850
|
+
tocItem.include.path = (0, import_path6.relative)(tocDir, (0, import_path6.resolve)(includeTocDir, path));
|
|
866
851
|
}
|
|
867
852
|
return acc.concat(tocItem);
|
|
868
853
|
}, []);
|
|
@@ -886,7 +871,7 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
886
871
|
for (const item of items) {
|
|
887
872
|
let includedInlineItems = null;
|
|
888
873
|
if (item.name) {
|
|
889
|
-
const tocPath = (0,
|
|
874
|
+
const tocPath = (0, import_path6.join)(tocDir, "toc.yaml");
|
|
890
875
|
item.name = _liquidSubstitutions(item.name, vars, tocPath);
|
|
891
876
|
}
|
|
892
877
|
try {
|
|
@@ -900,8 +885,8 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
900
885
|
}
|
|
901
886
|
if (item.include) {
|
|
902
887
|
const { mode = "root_merge" /* ROOT_MERGE */ } = item.include;
|
|
903
|
-
const includeTocPath = mode === "root_merge" /* ROOT_MERGE */ ? (0,
|
|
904
|
-
const includeTocDir = (0,
|
|
888
|
+
const includeTocPath = mode === "root_merge" /* ROOT_MERGE */ ? (0, import_path6.resolve)(sourcesDir, item.include.path) : (0, import_path6.resolve)(tocDir, item.include.path);
|
|
889
|
+
const includeTocDir = (0, import_path6.dirname)(includeTocPath);
|
|
905
890
|
try {
|
|
906
891
|
const includeToc = (0, import_js_yaml3.load)((0, import_fs2.readFileSync)(includeTocPath, "utf8"));
|
|
907
892
|
if (includeToc.stage === "tech-preview" /* TECH_PREVIEW */) {
|
|
@@ -934,7 +919,7 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
934
919
|
}
|
|
935
920
|
} catch (err) {
|
|
936
921
|
const message = `Error while including toc: ${(0, import_chalk2.bold)(includeTocPath)} to ${(0, import_chalk2.bold)(
|
|
937
|
-
(0,
|
|
922
|
+
(0, import_path6.join)(tocDir, "toc.yaml")
|
|
938
923
|
)}`;
|
|
939
924
|
import_log2.default.error(message);
|
|
940
925
|
continue;
|
|
@@ -955,8 +940,8 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
955
940
|
}
|
|
956
941
|
function getTocDir(pagePath) {
|
|
957
942
|
const { input: inputFolderPath } = argv_default.getConfig();
|
|
958
|
-
const tocDir = (0,
|
|
959
|
-
const tocPath = (0,
|
|
943
|
+
const tocDir = (0, import_path6.dirname)(pagePath);
|
|
944
|
+
const tocPath = (0, import_path6.resolve)(tocDir, "toc.yaml");
|
|
960
945
|
if (!tocDir.includes(inputFolderPath)) {
|
|
961
946
|
throw new Error("Error while finding toc dir");
|
|
962
947
|
}
|
|
@@ -982,21 +967,21 @@ var tocs_default = {
|
|
|
982
967
|
};
|
|
983
968
|
|
|
984
969
|
// src/services/preset.ts
|
|
985
|
-
var
|
|
970
|
+
var import_path7 = require("path");
|
|
986
971
|
var presetStorage = /* @__PURE__ */ new Map();
|
|
987
972
|
function add2(parsedPreset, path, varsPreset) {
|
|
988
973
|
const combinedValues = __spreadProps(__spreadValues(__spreadValues({}, parsedPreset.default || {}), parsedPreset[varsPreset] || {}), {
|
|
989
974
|
__metadata: parsedPreset.__metadata
|
|
990
975
|
});
|
|
991
|
-
const key = (0,
|
|
976
|
+
const key = (0, import_path7.dirname)((0, import_path7.normalize)(path));
|
|
992
977
|
presetStorage.set(key, combinedValues);
|
|
993
978
|
}
|
|
994
979
|
function get(path) {
|
|
995
980
|
let combinedValues = {};
|
|
996
|
-
let localPath = (0,
|
|
981
|
+
let localPath = (0, import_path7.normalize)(path);
|
|
997
982
|
while (localPath !== ".") {
|
|
998
983
|
const presetValues = presetStorage.get(localPath) || {};
|
|
999
|
-
localPath = (0,
|
|
984
|
+
localPath = (0, import_path7.dirname)(localPath);
|
|
1000
985
|
combinedValues = __spreadValues(__spreadValues({}, presetValues), combinedValues);
|
|
1001
986
|
}
|
|
1002
987
|
combinedValues = __spreadValues(__spreadValues({}, presetStorage.get(".")), combinedValues);
|
|
@@ -1016,7 +1001,7 @@ var preset_default = {
|
|
|
1016
1001
|
};
|
|
1017
1002
|
|
|
1018
1003
|
// src/services/argv.ts
|
|
1019
|
-
var
|
|
1004
|
+
var import_path8 = require("path");
|
|
1020
1005
|
var import_fs3 = require("fs");
|
|
1021
1006
|
var _argv;
|
|
1022
1007
|
function getConfig() {
|
|
@@ -1030,7 +1015,7 @@ function init2(argv) {
|
|
|
1030
1015
|
_argv.vars = JSON.parse(argv.vars);
|
|
1031
1016
|
}
|
|
1032
1017
|
try {
|
|
1033
|
-
const ignorefile = (0, import_fs3.readFileSync)((0,
|
|
1018
|
+
const ignorefile = (0, import_fs3.readFileSync)((0, import_path8.join)(_argv.rootInput, ".yfmignore"), "utf8");
|
|
1034
1019
|
const ignore = ignorefile.split("\n");
|
|
1035
1020
|
_argv.ignore = _argv.ignore.concat(ignore);
|
|
1036
1021
|
} catch (e) {
|
|
@@ -1046,8 +1031,6 @@ var argv_default = {
|
|
|
1046
1031
|
};
|
|
1047
1032
|
|
|
1048
1033
|
// src/services/leading.ts
|
|
1049
|
-
var import_path16 = require("path");
|
|
1050
|
-
var import_fs4 = require("fs");
|
|
1051
1034
|
var import_js_yaml4 = require("js-yaml");
|
|
1052
1035
|
var import_log3 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
1053
1036
|
|
|
@@ -1121,8 +1104,6 @@ function getDefaultLintConfig() {
|
|
|
1121
1104
|
}
|
|
1122
1105
|
|
|
1123
1106
|
// src/resolvers/md2md.ts
|
|
1124
|
-
var import_fs5 = require("fs");
|
|
1125
|
-
var import_path17 = require("path");
|
|
1126
1107
|
var import_shelljs3 = __toESM(require("shelljs"));
|
|
1127
1108
|
var import_log4 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
1128
1109
|
var import_liquid3 = __toESM(require("@diplodoc/transform/lib/liquid"));
|
|
@@ -1138,8 +1119,6 @@ function liquidMd2Md(input, vars, path) {
|
|
|
1138
1119
|
}
|
|
1139
1120
|
|
|
1140
1121
|
// src/resolvers/md2html.ts
|
|
1141
|
-
var import_path18 = require("path");
|
|
1142
|
-
var import_fs6 = require("fs");
|
|
1143
1122
|
var import_js_yaml5 = __toESM(require("js-yaml"));
|
|
1144
1123
|
var import_transform = __toESM(require("@diplodoc/transform"));
|
|
1145
1124
|
var import_log5 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
@@ -1153,10 +1132,10 @@ function liquidMd2Html(input, vars, path) {
|
|
|
1153
1132
|
}
|
|
1154
1133
|
|
|
1155
1134
|
// src/resolvers/lintPage.ts
|
|
1156
|
-
var
|
|
1135
|
+
var import_path9 = require("path");
|
|
1157
1136
|
var import_log6 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
1158
1137
|
var import_yfmlint = __toESM(require("@diplodoc/transform/lib/yfmlint"));
|
|
1159
|
-
var
|
|
1138
|
+
var import_fs4 = require("fs");
|
|
1160
1139
|
var import_chalk3 = require("chalk");
|
|
1161
1140
|
var FileLinter = {
|
|
1162
1141
|
".md": MdFileLinter
|
|
@@ -1164,9 +1143,9 @@ var FileLinter = {
|
|
|
1164
1143
|
function lintPage(options) {
|
|
1165
1144
|
const { inputPath, fileExtension, onFinish } = options;
|
|
1166
1145
|
const { input } = argv_default.getConfig();
|
|
1167
|
-
const resolvedPath = (0,
|
|
1146
|
+
const resolvedPath = (0, import_path9.resolve)(input, inputPath);
|
|
1168
1147
|
try {
|
|
1169
|
-
const content = (0,
|
|
1148
|
+
const content = (0, import_fs4.readFileSync)(resolvedPath, "utf8");
|
|
1170
1149
|
const lintFn = FileLinter[fileExtension];
|
|
1171
1150
|
if (!lintFn) {
|
|
1172
1151
|
return;
|
|
@@ -1186,10 +1165,10 @@ function MdFileLinter(content, lintOptions) {
|
|
|
1186
1165
|
const { path: filePath } = lintOptions;
|
|
1187
1166
|
const plugins2 = outputFormat === "md" ? [] : plugins_exports.getPlugins();
|
|
1188
1167
|
const vars = getVarsPerFile(filePath);
|
|
1189
|
-
const root = (0,
|
|
1190
|
-
const path = (0,
|
|
1168
|
+
const root = (0, import_path9.resolve)(input);
|
|
1169
|
+
const path = (0, import_path9.resolve)(input, filePath);
|
|
1191
1170
|
let preparedContent = content;
|
|
1192
|
-
const assetsPublicPath = (0,
|
|
1171
|
+
const assetsPublicPath = (0, import_path9.relative)((0, import_path9.dirname)(path), root);
|
|
1193
1172
|
const lintMarkdown = function lintMarkdown2(opts) {
|
|
1194
1173
|
const { input: localInput, path: localPath, sourceMap: sourceMap2 } = opts;
|
|
1195
1174
|
const pluginOptions = __spreadProps(__spreadValues({}, options), {
|
|
@@ -1242,7 +1221,7 @@ function run(_0) {
|
|
|
1242
1221
|
tocs_default.getNavigationPaths().forEach((pathToFile) => {
|
|
1243
1222
|
lintPage({
|
|
1244
1223
|
inputPath: pathToFile,
|
|
1245
|
-
fileExtension: (0,
|
|
1224
|
+
fileExtension: (0, import_path10.extname)(pathToFile),
|
|
1246
1225
|
onFinish: () => {
|
|
1247
1226
|
processedPages.next(pathToFile);
|
|
1248
1227
|
}
|