@diplodoc/cli 4.6.0-alpha-1 → 4.6.0-alpha-3
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 +178 -209
- package/build/index.js.map +4 -4
- package/build/linter.js +71 -100
- package/build/linter.js.map +4 -4
- package/build/pkg.json +3 -11
- package/package.json +4 -9
- package/src/constants.ts +2 -6
- package/src/steps/processAssets.ts +3 -5
- package/src/utils/markup.ts +9 -5
- package/build/app.client.css +0 -2684
- package/build/app.client.js +0 -3
- package/build/app.css +0 -4
- package/build/app.js +0 -2
- package/build/react.js +0 -3
- package/build/vendor.css +0 -3530
- package/build/vendor.js +0 -3
package/build/linter.js
CHANGED
|
@@ -34,9 +34,6 @@ var __objRest = (source, exclude) => {
|
|
|
34
34
|
}
|
|
35
35
|
return target;
|
|
36
36
|
};
|
|
37
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
38
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
39
|
-
};
|
|
40
37
|
var __export = (target, all) => {
|
|
41
38
|
for (var name4 in all)
|
|
42
39
|
__defProp(target, name4, { get: all[name4], enumerable: true });
|
|
@@ -59,7 +56,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
59
56
|
));
|
|
60
57
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
61
58
|
var __async = (__this, __arguments, generator) => {
|
|
62
|
-
return new Promise((
|
|
59
|
+
return new Promise((resolve11, reject) => {
|
|
63
60
|
var fulfilled = (value) => {
|
|
64
61
|
try {
|
|
65
62
|
step(generator.next(value));
|
|
@@ -74,48 +71,21 @@ var __async = (__this, __arguments, generator) => {
|
|
|
74
71
|
reject(e);
|
|
75
72
|
}
|
|
76
73
|
};
|
|
77
|
-
var step = (x) => x.done ?
|
|
74
|
+
var step = (x) => x.done ? resolve11(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 manifest = require("@diplodoc/client/manifest");
|
|
88
|
-
var CLIENT_PATH = path.dirname(require.resolve("@diplodoc/client/manifest"));
|
|
89
|
-
var BUILD_PATH = path.resolve(__dirname, "..", "build");
|
|
90
|
-
var src = (target) => path.resolve(CLIENT_PATH, target);
|
|
91
|
-
var dst = (target) => path.resolve(BUILD_PATH, target);
|
|
92
|
-
module2.exports = {
|
|
93
|
-
assets: [
|
|
94
|
-
...manifest.js.map((path2) => [src(path2), dst(path2)]),
|
|
95
|
-
...manifest.css.map((path2) => [src(path2), dst(path2)])
|
|
96
|
-
],
|
|
97
|
-
bundle: {
|
|
98
|
-
js(bundlePath) {
|
|
99
|
-
return manifest.js.map((src2) => path.join(bundlePath, src2));
|
|
100
|
-
},
|
|
101
|
-
css(bundlePath) {
|
|
102
|
-
return manifest.css.map((src2) => path.join(bundlePath, src2));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
79
|
// src/workers/linter/index.ts
|
|
110
80
|
var linter_exports = {};
|
|
111
81
|
module.exports = __toCommonJS(linter_exports);
|
|
112
82
|
var import_log7 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
113
|
-
var
|
|
83
|
+
var import_path20 = require("path");
|
|
114
84
|
var import_observable = require("threads/observable");
|
|
115
85
|
var import_threads = require("threads");
|
|
116
86
|
|
|
117
87
|
// src/services/tocs.ts
|
|
118
|
-
var
|
|
88
|
+
var import_path13 = require("path");
|
|
119
89
|
var import_fs2 = require("fs");
|
|
120
90
|
var import_js_yaml3 = require("js-yaml");
|
|
121
91
|
var import_shelljs2 = __toESM(require("shelljs"));
|
|
@@ -163,6 +133,7 @@ var logger = {
|
|
|
163
133
|
};
|
|
164
134
|
|
|
165
135
|
// src/utils/markup.ts
|
|
136
|
+
var import_path3 = require("path");
|
|
166
137
|
var import_process = require("process");
|
|
167
138
|
|
|
168
139
|
// src/constants.ts
|
|
@@ -190,7 +161,7 @@ var openapi = require("@diplodoc/openapi-extension");
|
|
|
190
161
|
includes.collect = require("@diplodoc/transform/lib/plugins/includes/collect");
|
|
191
162
|
images.collect = require("@diplodoc/transform/lib/plugins/images/collect");
|
|
192
163
|
changelog.collect = require("@diplodoc/transform/lib/plugins/changelog/collect");
|
|
193
|
-
var
|
|
164
|
+
var ASSETS_FOLDER = (0, import_path.resolve)(__dirname, "..", "assets");
|
|
194
165
|
var YFM_PLUGINS = [
|
|
195
166
|
meta,
|
|
196
167
|
deflist,
|
|
@@ -234,14 +205,14 @@ function isExternalHref(href) {
|
|
|
234
205
|
|
|
235
206
|
// src/utils/markup.ts
|
|
236
207
|
var import_client = require("@diplodoc/client");
|
|
237
|
-
var
|
|
208
|
+
var import_manifest = __toESM(require("@diplodoc/client/manifest"));
|
|
238
209
|
var \u0441arriage = import_process.platform === "win32" /* WINDOWS */ ? "\r\n" : "\n";
|
|
239
210
|
|
|
240
211
|
// src/utils/path.ts
|
|
241
|
-
var
|
|
212
|
+
var import_path4 = require("path");
|
|
242
213
|
|
|
243
214
|
// src/utils/toc.ts
|
|
244
|
-
var
|
|
215
|
+
var import_path5 = require("path");
|
|
245
216
|
|
|
246
217
|
// src/services/utils.ts
|
|
247
218
|
var import_evaluation = __toESM(require("@diplodoc/transform/lib/liquid/evaluation"));
|
|
@@ -326,15 +297,15 @@ function isObject(o) {
|
|
|
326
297
|
}
|
|
327
298
|
|
|
328
299
|
// src/utils/presets.ts
|
|
329
|
-
var
|
|
300
|
+
var import_path6 = require("path");
|
|
330
301
|
function getVarsPerFile(filePath) {
|
|
331
302
|
const { vars: argVars } = argv_default.getConfig();
|
|
332
|
-
return __spreadValues(__spreadValues({}, preset_default.get((0,
|
|
303
|
+
return __spreadValues(__spreadValues({}, preset_default.get((0, import_path6.dirname)(filePath))), argVars);
|
|
333
304
|
}
|
|
334
305
|
function getVarsPerRelativeFile(filePath) {
|
|
335
306
|
const { input } = argv_default.getConfig();
|
|
336
|
-
const root = (0,
|
|
337
|
-
const relativeFilePath = (0,
|
|
307
|
+
const root = (0, import_path6.resolve)(input);
|
|
308
|
+
const relativeFilePath = (0, import_path6.relative)(root, filePath);
|
|
338
309
|
return getVarsPerFile(relativeFilePath);
|
|
339
310
|
}
|
|
340
311
|
|
|
@@ -347,15 +318,15 @@ var glob = (pattern, options) => __async(void 0, null, function* () {
|
|
|
347
318
|
});
|
|
348
319
|
|
|
349
320
|
// src/utils/file.ts
|
|
350
|
-
var
|
|
321
|
+
var import_path7 = require("path");
|
|
351
322
|
var import_shelljs = __toESM(require("shelljs"));
|
|
352
323
|
|
|
353
324
|
// src/services/contributors.ts
|
|
354
325
|
var import_promises = require("fs/promises");
|
|
355
|
-
var
|
|
326
|
+
var import_path8 = require("path");
|
|
356
327
|
|
|
357
328
|
// src/services/metadata.ts
|
|
358
|
-
var
|
|
329
|
+
var import_path9 = require("path");
|
|
359
330
|
function getContentWithUpdatedStaticMetadata({
|
|
360
331
|
fileContent,
|
|
361
332
|
sourcePath,
|
|
@@ -412,7 +383,7 @@ __export(includers_exports, {
|
|
|
412
383
|
applyIncluders: () => applyIncluders,
|
|
413
384
|
init: () => init
|
|
414
385
|
});
|
|
415
|
-
var
|
|
386
|
+
var import_path12 = require("path");
|
|
416
387
|
var import_lodash3 = require("lodash");
|
|
417
388
|
|
|
418
389
|
// src/services/includers/batteries/generic.ts
|
|
@@ -423,7 +394,7 @@ __export(generic_exports, {
|
|
|
423
394
|
name: () => name
|
|
424
395
|
});
|
|
425
396
|
var import_promises2 = require("fs/promises");
|
|
426
|
-
var
|
|
397
|
+
var import_path10 = require("path");
|
|
427
398
|
var import_lodash2 = require("lodash");
|
|
428
399
|
var import_js_yaml2 = require("js-yaml");
|
|
429
400
|
var GenericIncluderError = class extends Error {
|
|
@@ -451,8 +422,8 @@ function includerFunction(params) {
|
|
|
451
422
|
}
|
|
452
423
|
try {
|
|
453
424
|
const leadingPageName = (_b = leadingPage == null ? void 0 : leadingPage.name) != null ? _b : "Overview";
|
|
454
|
-
const tocDirPath = (0,
|
|
455
|
-
const contentPath = index === 0 ? (0,
|
|
425
|
+
const tocDirPath = (0, import_path10.dirname)(tocPath);
|
|
426
|
+
const contentPath = index === 0 ? (0, import_path10.join)(writeBasePath, tocDirPath, input) : (0, import_path10.join)(readBasePath, tocDirPath, input);
|
|
456
427
|
let cache = {};
|
|
457
428
|
let found = [];
|
|
458
429
|
({
|
|
@@ -463,16 +434,16 @@ function includerFunction(params) {
|
|
|
463
434
|
nocase: true,
|
|
464
435
|
cache
|
|
465
436
|
}));
|
|
466
|
-
const writePath = (0,
|
|
437
|
+
const writePath = (0, import_path10.join)(writeBasePath, tocDirPath, item.include.path);
|
|
467
438
|
yield (0, import_promises2.mkdir)(writePath, { recursive: true });
|
|
468
439
|
for (const filePath of found) {
|
|
469
|
-
const file = yield (0, import_promises2.readFile)((0,
|
|
470
|
-
yield (0, import_promises2.mkdir)((0,
|
|
471
|
-
yield (0, import_promises2.writeFile)((0,
|
|
440
|
+
const file = yield (0, import_promises2.readFile)((0, import_path10.join)(contentPath, filePath));
|
|
441
|
+
yield (0, import_promises2.mkdir)((0, import_path10.dirname)((0, import_path10.join)(writePath, filePath)), { recursive: true });
|
|
442
|
+
yield (0, import_promises2.writeFile)((0, import_path10.join)(writePath, filePath), file);
|
|
472
443
|
}
|
|
473
444
|
const graph = createGraphFromPaths(found);
|
|
474
445
|
const toc = createToc(leadingPageName, item.include.path)(graph, []);
|
|
475
|
-
yield (0, import_promises2.writeFile)((0,
|
|
446
|
+
yield (0, import_promises2.writeFile)((0, import_path10.join)(writePath, "toc.yaml"), (0, import_js_yaml2.dump)(toc));
|
|
476
447
|
} catch (err) {
|
|
477
448
|
throw new GenericIncluderError(err.toString(), tocPath);
|
|
478
449
|
}
|
|
@@ -504,8 +475,8 @@ function createToc(leadingPageName, tocName) {
|
|
|
504
475
|
return function createTocRec(graph, cursor) {
|
|
505
476
|
var _a, _b;
|
|
506
477
|
const handler = (file) => ({
|
|
507
|
-
name: (0,
|
|
508
|
-
href: (0,
|
|
478
|
+
name: (0, import_path10.parse)(file).name === "index" ? leadingPageName : file,
|
|
479
|
+
href: (0, import_path10.join)(...cursor, file)
|
|
509
480
|
});
|
|
510
481
|
const recurse = (key) => createTocRec(graph[key], [...cursor, key]);
|
|
511
482
|
const current = {
|
|
@@ -556,7 +527,7 @@ __export(unarchive_exports, {
|
|
|
556
527
|
name: () => name3
|
|
557
528
|
});
|
|
558
529
|
var import_fs = require("fs");
|
|
559
|
-
var
|
|
530
|
+
var import_path11 = require("path");
|
|
560
531
|
var import_tar_stream = require("tar-stream");
|
|
561
532
|
var name3 = "unarchive";
|
|
562
533
|
var UnarchiveIncluderError = class extends Error {
|
|
@@ -579,8 +550,8 @@ function pipeline(readPath, writeBasePath) {
|
|
|
579
550
|
(0, import_fs.mkdirSync)(writeBasePath, { recursive: true });
|
|
580
551
|
extractor.on("entry", (header, stream, next) => {
|
|
581
552
|
const { type, name: name4 } = header;
|
|
582
|
-
const writePath = (0,
|
|
583
|
-
const writeDirPath = type === "directory" ? writePath : (0,
|
|
553
|
+
const writePath = (0, import_path11.join)(writeBasePath, name4);
|
|
554
|
+
const writeDirPath = type === "directory" ? writePath : (0, import_path11.dirname)(writePath);
|
|
584
555
|
(0, import_fs.mkdirSync)(writeDirPath, { recursive: true });
|
|
585
556
|
if (type !== "directory") {
|
|
586
557
|
const writer = (0, import_fs.createWriteStream)(writePath, { flags: "w" });
|
|
@@ -611,8 +582,8 @@ function includerFunction3(params) {
|
|
|
611
582
|
if (!(input == null ? void 0 : input.length) || !(output == null ? void 0 : output.length)) {
|
|
612
583
|
throw new UnarchiveIncluderError("provide includer with input parameter", tocPath);
|
|
613
584
|
}
|
|
614
|
-
const contentPath = index === 0 ? (0,
|
|
615
|
-
const writePath = (0,
|
|
585
|
+
const contentPath = index === 0 ? (0, import_path11.join)(writeBasePath, input) : (0, import_path11.join)(readBasePath, input);
|
|
586
|
+
const writePath = (0, import_path11.join)(writeBasePath, output);
|
|
616
587
|
try {
|
|
617
588
|
yield pipeline(contentPath, writePath);
|
|
618
589
|
} catch (err) {
|
|
@@ -669,7 +640,7 @@ function applyIncluders(path, item, vars) {
|
|
|
669
640
|
const passedParams = __spreadValues({}, rest);
|
|
670
641
|
yield applyIncluder({ path, item, includer, passedParams, index, vars });
|
|
671
642
|
}
|
|
672
|
-
item.include.path = (0,
|
|
643
|
+
item.include.path = (0, import_path12.join)(item.include.path, "toc.yaml");
|
|
673
644
|
index++;
|
|
674
645
|
});
|
|
675
646
|
}
|
|
@@ -741,8 +712,8 @@ function add(path) {
|
|
|
741
712
|
ignoreStage,
|
|
742
713
|
vars
|
|
743
714
|
} = argv_default.getConfig();
|
|
744
|
-
const pathToDir = (0,
|
|
745
|
-
const content = (0, import_fs2.readFileSync)((0,
|
|
715
|
+
const pathToDir = (0, import_path13.dirname)(path);
|
|
716
|
+
const content = (0, import_fs2.readFileSync)((0, import_path13.resolve)(inputFolderPath, path), "utf8");
|
|
746
717
|
const parsedToc = (0, import_js_yaml3.load)(content);
|
|
747
718
|
if (parsedToc.stage === ignoreStage) {
|
|
748
719
|
return;
|
|
@@ -759,16 +730,16 @@ function add(path) {
|
|
|
759
730
|
parsedToc.items = yield processTocItems(
|
|
760
731
|
path,
|
|
761
732
|
parsedToc.items,
|
|
762
|
-
(0,
|
|
763
|
-
(0,
|
|
733
|
+
(0, import_path13.join)(inputFolderPath, pathToDir),
|
|
734
|
+
(0, import_path13.resolve)(inputFolderPath),
|
|
764
735
|
combinedVars
|
|
765
736
|
);
|
|
766
737
|
storage.set(path, parsedToc);
|
|
767
738
|
parsedToc.base = pathToDir;
|
|
768
739
|
if (outputFormat === "md") {
|
|
769
|
-
const outputPath = (0,
|
|
740
|
+
const outputPath = (0, import_path13.resolve)(outputFolderPath, path);
|
|
770
741
|
const outputToc = (0, import_js_yaml3.dump)(parsedToc);
|
|
771
|
-
import_shelljs2.default.mkdir("-p", (0,
|
|
742
|
+
import_shelljs2.default.mkdir("-p", (0, import_path13.dirname)(outputPath));
|
|
772
743
|
(0, import_fs2.writeFileSync)(outputPath, outputToc);
|
|
773
744
|
}
|
|
774
745
|
prepareNavigationPaths(parsedToc, pathToDir);
|
|
@@ -811,7 +782,7 @@ function prepareNavigationPaths(parsedToc, dirPath) {
|
|
|
811
782
|
processItems(preparedSubItems, pathToDir);
|
|
812
783
|
}
|
|
813
784
|
if (item.href && !isExternalHref(item.href)) {
|
|
814
|
-
const href = (0,
|
|
785
|
+
const href = (0, import_path13.join)(pathToDir, item.href);
|
|
815
786
|
storage.set(href, parsedToc);
|
|
816
787
|
const navigationPath = _normalizeHref(href);
|
|
817
788
|
navigationPaths.push(navigationPath);
|
|
@@ -821,32 +792,32 @@ function prepareNavigationPaths(parsedToc, dirPath) {
|
|
|
821
792
|
processItems([parsedToc], dirPath);
|
|
822
793
|
}
|
|
823
794
|
function _normalizeHref(href) {
|
|
824
|
-
const preparedHref = (0,
|
|
795
|
+
const preparedHref = (0, import_path13.normalize)(href);
|
|
825
796
|
if (preparedHref.endsWith(".md") || preparedHref.endsWith(".yaml")) {
|
|
826
797
|
return preparedHref;
|
|
827
798
|
}
|
|
828
|
-
if (preparedHref.endsWith(
|
|
799
|
+
if (preparedHref.endsWith(import_path13.sep)) {
|
|
829
800
|
return `${preparedHref}index.yaml`;
|
|
830
801
|
}
|
|
831
802
|
return `${preparedHref}.md`;
|
|
832
803
|
}
|
|
833
804
|
function _copyTocDir(tocPath, destDir) {
|
|
834
805
|
const { input: inputFolderPath } = argv_default.getConfig();
|
|
835
|
-
const { dir: tocDir } = (0,
|
|
806
|
+
const { dir: tocDir } = (0, import_path13.parse)(tocPath);
|
|
836
807
|
const files = (0, import_walk_sync.default)(tocDir, {
|
|
837
808
|
globs: ["**/*.*"],
|
|
838
809
|
ignore: ["**/toc.yaml"],
|
|
839
810
|
directories: false
|
|
840
811
|
});
|
|
841
812
|
files.forEach((relPath) => {
|
|
842
|
-
const from = (0,
|
|
843
|
-
const to = (0,
|
|
844
|
-
const fileExtension = (0,
|
|
813
|
+
const from = (0, import_path13.resolve)(tocDir, relPath);
|
|
814
|
+
const to = (0, import_path13.resolve)(destDir, relPath);
|
|
815
|
+
const fileExtension = (0, import_path13.extname)(relPath);
|
|
845
816
|
const isMdFile = fileExtension === ".md";
|
|
846
|
-
import_shelljs2.default.mkdir("-p", (0,
|
|
817
|
+
import_shelljs2.default.mkdir("-p", (0, import_path13.parse)(to).dir);
|
|
847
818
|
if (isMdFile) {
|
|
848
819
|
const fileContent = (0, import_fs2.readFileSync)(from, "utf8");
|
|
849
|
-
const sourcePath = (0,
|
|
820
|
+
const sourcePath = (0, import_path13.relative)(inputFolderPath, from);
|
|
850
821
|
const updatedFileContent = getContentWithUpdatedStaticMetadata({
|
|
851
822
|
fileContent,
|
|
852
823
|
sourcePath,
|
|
@@ -861,14 +832,14 @@ function _copyTocDir(tocPath, destDir) {
|
|
|
861
832
|
function _replaceIncludesHrefs(items, includeTocDir, tocDir) {
|
|
862
833
|
return items.reduce((acc, tocItem) => {
|
|
863
834
|
if (tocItem.href) {
|
|
864
|
-
tocItem.href = (0,
|
|
835
|
+
tocItem.href = (0, import_path13.relative)(tocDir, (0, import_path13.resolve)(includeTocDir, tocItem.href));
|
|
865
836
|
}
|
|
866
837
|
if (tocItem.items) {
|
|
867
838
|
tocItem.items = _replaceIncludesHrefs(tocItem.items, includeTocDir, tocDir);
|
|
868
839
|
}
|
|
869
840
|
if (tocItem.include) {
|
|
870
841
|
const { path } = tocItem.include;
|
|
871
|
-
tocItem.include.path = (0,
|
|
842
|
+
tocItem.include.path = (0, import_path13.relative)(tocDir, (0, import_path13.resolve)(includeTocDir, path));
|
|
872
843
|
}
|
|
873
844
|
return acc.concat(tocItem);
|
|
874
845
|
}, []);
|
|
@@ -892,7 +863,7 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
892
863
|
for (const item of items) {
|
|
893
864
|
let includedInlineItems = null;
|
|
894
865
|
if (item.name) {
|
|
895
|
-
const tocPath = (0,
|
|
866
|
+
const tocPath = (0, import_path13.join)(tocDir, "toc.yaml");
|
|
896
867
|
item.name = _liquidSubstitutions(item.name, vars, tocPath);
|
|
897
868
|
}
|
|
898
869
|
try {
|
|
@@ -906,8 +877,8 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
906
877
|
}
|
|
907
878
|
if (item.include) {
|
|
908
879
|
const { mode = "root_merge" /* ROOT_MERGE */ } = item.include;
|
|
909
|
-
const includeTocPath = mode === "root_merge" /* ROOT_MERGE */ ? (0,
|
|
910
|
-
const includeTocDir = (0,
|
|
880
|
+
const includeTocPath = mode === "root_merge" /* ROOT_MERGE */ ? (0, import_path13.resolve)(sourcesDir, item.include.path) : (0, import_path13.resolve)(tocDir, item.include.path);
|
|
881
|
+
const includeTocDir = (0, import_path13.dirname)(includeTocPath);
|
|
911
882
|
try {
|
|
912
883
|
const includeToc = (0, import_js_yaml3.load)((0, import_fs2.readFileSync)(includeTocPath, "utf8"));
|
|
913
884
|
if (includeToc.stage === "tech-preview" /* TECH_PREVIEW */) {
|
|
@@ -940,7 +911,7 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
940
911
|
}
|
|
941
912
|
} catch (err) {
|
|
942
913
|
const message = `Error while including toc: ${(0, import_chalk2.bold)(includeTocPath)} to ${(0, import_chalk2.bold)(
|
|
943
|
-
(0,
|
|
914
|
+
(0, import_path13.join)(tocDir, "toc.yaml")
|
|
944
915
|
)}`;
|
|
945
916
|
import_log2.default.error(message);
|
|
946
917
|
continue;
|
|
@@ -961,8 +932,8 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
961
932
|
}
|
|
962
933
|
function getTocDir(pagePath) {
|
|
963
934
|
const { input: inputFolderPath } = argv_default.getConfig();
|
|
964
|
-
const tocDir = (0,
|
|
965
|
-
const tocPath = (0,
|
|
935
|
+
const tocDir = (0, import_path13.dirname)(pagePath);
|
|
936
|
+
const tocPath = (0, import_path13.resolve)(tocDir, "toc.yaml");
|
|
966
937
|
if (!tocDir.includes(inputFolderPath)) {
|
|
967
938
|
throw new Error("Error while finding toc dir");
|
|
968
939
|
}
|
|
@@ -984,19 +955,19 @@ var tocs_default = {
|
|
|
984
955
|
};
|
|
985
956
|
|
|
986
957
|
// src/services/preset.ts
|
|
987
|
-
var
|
|
958
|
+
var import_path14 = require("path");
|
|
988
959
|
var presetStorage = /* @__PURE__ */ new Map();
|
|
989
960
|
function add2(parsedPreset, path, varsPreset) {
|
|
990
961
|
const combinedValues = __spreadValues(__spreadValues({}, parsedPreset.default || {}), parsedPreset[varsPreset] || {});
|
|
991
|
-
const key = (0,
|
|
962
|
+
const key = (0, import_path14.dirname)((0, import_path14.normalize)(path));
|
|
992
963
|
presetStorage.set(key, combinedValues);
|
|
993
964
|
}
|
|
994
965
|
function get(path) {
|
|
995
966
|
let combinedValues = {};
|
|
996
|
-
let localPath = (0,
|
|
967
|
+
let localPath = (0, import_path14.normalize)(path);
|
|
997
968
|
while (localPath !== ".") {
|
|
998
969
|
const presetValues = presetStorage.get(localPath) || {};
|
|
999
|
-
localPath = (0,
|
|
970
|
+
localPath = (0, import_path14.dirname)(localPath);
|
|
1000
971
|
combinedValues = __spreadValues(__spreadValues({}, presetValues), combinedValues);
|
|
1001
972
|
}
|
|
1002
973
|
combinedValues = __spreadValues(__spreadValues({}, presetStorage.get(".")), combinedValues);
|
|
@@ -1016,7 +987,7 @@ var preset_default = {
|
|
|
1016
987
|
};
|
|
1017
988
|
|
|
1018
989
|
// src/services/argv.ts
|
|
1019
|
-
var
|
|
990
|
+
var import_path15 = require("path");
|
|
1020
991
|
var import_fs3 = require("fs");
|
|
1021
992
|
var _argv;
|
|
1022
993
|
function getConfig() {
|
|
@@ -1030,7 +1001,7 @@ function init2(argv) {
|
|
|
1030
1001
|
_argv.vars = JSON.parse(argv.vars);
|
|
1031
1002
|
}
|
|
1032
1003
|
try {
|
|
1033
|
-
const ignorefile = (0, import_fs3.readFileSync)((0,
|
|
1004
|
+
const ignorefile = (0, import_fs3.readFileSync)((0, import_path15.join)(_argv.rootInput, ".yfmignore"), "utf8");
|
|
1034
1005
|
const ignore = ignorefile.split("\n");
|
|
1035
1006
|
_argv.ignore = _argv.ignore.concat(ignore);
|
|
1036
1007
|
} catch (e) {
|
|
@@ -1046,7 +1017,7 @@ var argv_default = {
|
|
|
1046
1017
|
};
|
|
1047
1018
|
|
|
1048
1019
|
// src/services/leading.ts
|
|
1049
|
-
var
|
|
1020
|
+
var import_path16 = require("path");
|
|
1050
1021
|
var import_fs4 = require("fs");
|
|
1051
1022
|
var import_js_yaml4 = require("js-yaml");
|
|
1052
1023
|
var import_log3 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
@@ -1122,7 +1093,7 @@ function getDefaultLintConfig() {
|
|
|
1122
1093
|
|
|
1123
1094
|
// src/resolvers/md2md.ts
|
|
1124
1095
|
var import_fs5 = require("fs");
|
|
1125
|
-
var
|
|
1096
|
+
var import_path17 = require("path");
|
|
1126
1097
|
var import_shelljs3 = __toESM(require("shelljs"));
|
|
1127
1098
|
var import_log4 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
1128
1099
|
var import_liquid3 = __toESM(require("@diplodoc/transform/lib/liquid"));
|
|
@@ -1138,7 +1109,7 @@ function liquidMd2Md(input, vars, path) {
|
|
|
1138
1109
|
}
|
|
1139
1110
|
|
|
1140
1111
|
// src/resolvers/md2html.ts
|
|
1141
|
-
var
|
|
1112
|
+
var import_path18 = require("path");
|
|
1142
1113
|
var import_fs6 = require("fs");
|
|
1143
1114
|
var import_js_yaml5 = __toESM(require("js-yaml"));
|
|
1144
1115
|
var import_transform = __toESM(require("@diplodoc/transform"));
|
|
@@ -1153,7 +1124,7 @@ function liquidMd2Html(input, vars, path) {
|
|
|
1153
1124
|
}
|
|
1154
1125
|
|
|
1155
1126
|
// src/resolvers/lintPage.ts
|
|
1156
|
-
var
|
|
1127
|
+
var import_path19 = require("path");
|
|
1157
1128
|
var import_log6 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
1158
1129
|
var import_yfmlint = __toESM(require("@diplodoc/transform/lib/yfmlint"));
|
|
1159
1130
|
var import_fs7 = require("fs");
|
|
@@ -1164,7 +1135,7 @@ var FileLinter = {
|
|
|
1164
1135
|
function lintPage(options) {
|
|
1165
1136
|
const { inputPath, fileExtension, onFinish } = options;
|
|
1166
1137
|
const { input } = argv_default.getConfig();
|
|
1167
|
-
const resolvedPath = (0,
|
|
1138
|
+
const resolvedPath = (0, import_path19.resolve)(input, inputPath);
|
|
1168
1139
|
try {
|
|
1169
1140
|
const content = (0, import_fs7.readFileSync)(resolvedPath, "utf8");
|
|
1170
1141
|
const lintFn = FileLinter[fileExtension];
|
|
@@ -1186,10 +1157,10 @@ function MdFileLinter(content, lintOptions) {
|
|
|
1186
1157
|
const { path: filePath } = lintOptions;
|
|
1187
1158
|
const plugins2 = outputFormat === "md" ? [] : plugins_exports.getPlugins();
|
|
1188
1159
|
const vars = getVarsPerFile(filePath);
|
|
1189
|
-
const root = (0,
|
|
1190
|
-
const path = (0,
|
|
1160
|
+
const root = (0, import_path19.resolve)(input);
|
|
1161
|
+
const path = (0, import_path19.resolve)(input, filePath);
|
|
1191
1162
|
let preparedContent = content;
|
|
1192
|
-
const assetsPublicPath = (0,
|
|
1163
|
+
const assetsPublicPath = (0, import_path19.relative)((0, import_path19.dirname)(path), root);
|
|
1193
1164
|
const lintMarkdown = function lintMarkdown2(opts) {
|
|
1194
1165
|
const { input: localInput, path: localPath, sourceMap: sourceMap2 } = opts;
|
|
1195
1166
|
const pluginOptions = __spreadProps(__spreadValues({}, options), {
|
|
@@ -1242,7 +1213,7 @@ function run(_0) {
|
|
|
1242
1213
|
tocs_default.getNavigationPaths().forEach((pathToFile) => {
|
|
1243
1214
|
lintPage({
|
|
1244
1215
|
inputPath: pathToFile,
|
|
1245
|
-
fileExtension: (0,
|
|
1216
|
+
fileExtension: (0, import_path20.extname)(pathToFile),
|
|
1246
1217
|
onFinish: () => {
|
|
1247
1218
|
processedPages.next(pathToFile);
|
|
1248
1219
|
}
|