@diplodoc/cli 4.5.1 → 4.6.0-alpha-2
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 +180 -216
- package/build/index.js.map +4 -4
- package/build/linter.js +71 -105
- package/build/linter.js.map +4 -4
- package/build/pkg.json +9 -0
- package/package.json +3 -4
- package/src/constants.ts +2 -6
- package/src/steps/processAssets.ts +3 -5
- package/src/utils/markup.ts +16 -5
- package/build/app.client.css +0 -2684
- package/build/app.client.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,53 +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 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/workers/linter/index.ts
|
|
115
80
|
var linter_exports = {};
|
|
116
81
|
module.exports = __toCommonJS(linter_exports);
|
|
117
82
|
var import_log7 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
118
|
-
var
|
|
83
|
+
var import_path20 = require("path");
|
|
119
84
|
var import_observable = require("threads/observable");
|
|
120
85
|
var import_threads = require("threads");
|
|
121
86
|
|
|
122
87
|
// src/services/tocs.ts
|
|
123
|
-
var
|
|
88
|
+
var import_path13 = require("path");
|
|
124
89
|
var import_fs2 = require("fs");
|
|
125
90
|
var import_js_yaml3 = require("js-yaml");
|
|
126
91
|
var import_shelljs2 = __toESM(require("shelljs"));
|
|
@@ -168,6 +133,7 @@ var logger = {
|
|
|
168
133
|
};
|
|
169
134
|
|
|
170
135
|
// src/utils/markup.ts
|
|
136
|
+
var import_path3 = require("path");
|
|
171
137
|
var import_process = require("process");
|
|
172
138
|
|
|
173
139
|
// src/constants.ts
|
|
@@ -195,7 +161,7 @@ var openapi = require("@diplodoc/openapi-extension");
|
|
|
195
161
|
includes.collect = require("@diplodoc/transform/lib/plugins/includes/collect");
|
|
196
162
|
images.collect = require("@diplodoc/transform/lib/plugins/images/collect");
|
|
197
163
|
changelog.collect = require("@diplodoc/transform/lib/plugins/changelog/collect");
|
|
198
|
-
var
|
|
164
|
+
var ASSETS_FOLDER = (0, import_path.resolve)(__dirname, "..", "assets");
|
|
199
165
|
var YFM_PLUGINS = [
|
|
200
166
|
meta,
|
|
201
167
|
deflist,
|
|
@@ -239,14 +205,14 @@ function isExternalHref(href) {
|
|
|
239
205
|
|
|
240
206
|
// src/utils/markup.ts
|
|
241
207
|
var import_client = require("@diplodoc/client");
|
|
242
|
-
var
|
|
208
|
+
var import_manifest = __toESM(require("@diplodoc/client/manifest"));
|
|
243
209
|
var \u0441arriage = import_process.platform === "win32" /* WINDOWS */ ? "\r\n" : "\n";
|
|
244
210
|
|
|
245
211
|
// src/utils/path.ts
|
|
246
|
-
var
|
|
212
|
+
var import_path4 = require("path");
|
|
247
213
|
|
|
248
214
|
// src/utils/toc.ts
|
|
249
|
-
var
|
|
215
|
+
var import_path5 = require("path");
|
|
250
216
|
|
|
251
217
|
// src/services/utils.ts
|
|
252
218
|
var import_evaluation = __toESM(require("@diplodoc/transform/lib/liquid/evaluation"));
|
|
@@ -331,15 +297,15 @@ function isObject(o) {
|
|
|
331
297
|
}
|
|
332
298
|
|
|
333
299
|
// src/utils/presets.ts
|
|
334
|
-
var
|
|
300
|
+
var import_path6 = require("path");
|
|
335
301
|
function getVarsPerFile(filePath) {
|
|
336
302
|
const { vars: argVars } = argv_default.getConfig();
|
|
337
|
-
return __spreadValues(__spreadValues({}, preset_default.get((0,
|
|
303
|
+
return __spreadValues(__spreadValues({}, preset_default.get((0, import_path6.dirname)(filePath))), argVars);
|
|
338
304
|
}
|
|
339
305
|
function getVarsPerRelativeFile(filePath) {
|
|
340
306
|
const { input } = argv_default.getConfig();
|
|
341
|
-
const root = (0,
|
|
342
|
-
const relativeFilePath = (0,
|
|
307
|
+
const root = (0, import_path6.resolve)(input);
|
|
308
|
+
const relativeFilePath = (0, import_path6.relative)(root, filePath);
|
|
343
309
|
return getVarsPerFile(relativeFilePath);
|
|
344
310
|
}
|
|
345
311
|
|
|
@@ -352,15 +318,15 @@ var glob = (pattern, options) => __async(void 0, null, function* () {
|
|
|
352
318
|
});
|
|
353
319
|
|
|
354
320
|
// src/utils/file.ts
|
|
355
|
-
var
|
|
321
|
+
var import_path7 = require("path");
|
|
356
322
|
var import_shelljs = __toESM(require("shelljs"));
|
|
357
323
|
|
|
358
324
|
// src/services/contributors.ts
|
|
359
325
|
var import_promises = require("fs/promises");
|
|
360
|
-
var
|
|
326
|
+
var import_path8 = require("path");
|
|
361
327
|
|
|
362
328
|
// src/services/metadata.ts
|
|
363
|
-
var
|
|
329
|
+
var import_path9 = require("path");
|
|
364
330
|
function getContentWithUpdatedStaticMetadata({
|
|
365
331
|
fileContent,
|
|
366
332
|
sourcePath,
|
|
@@ -417,7 +383,7 @@ __export(includers_exports, {
|
|
|
417
383
|
applyIncluders: () => applyIncluders,
|
|
418
384
|
init: () => init
|
|
419
385
|
});
|
|
420
|
-
var
|
|
386
|
+
var import_path12 = require("path");
|
|
421
387
|
var import_lodash3 = require("lodash");
|
|
422
388
|
|
|
423
389
|
// src/services/includers/batteries/generic.ts
|
|
@@ -428,7 +394,7 @@ __export(generic_exports, {
|
|
|
428
394
|
name: () => name
|
|
429
395
|
});
|
|
430
396
|
var import_promises2 = require("fs/promises");
|
|
431
|
-
var
|
|
397
|
+
var import_path10 = require("path");
|
|
432
398
|
var import_lodash2 = require("lodash");
|
|
433
399
|
var import_js_yaml2 = require("js-yaml");
|
|
434
400
|
var GenericIncluderError = class extends Error {
|
|
@@ -456,8 +422,8 @@ function includerFunction(params) {
|
|
|
456
422
|
}
|
|
457
423
|
try {
|
|
458
424
|
const leadingPageName = (_b = leadingPage == null ? void 0 : leadingPage.name) != null ? _b : "Overview";
|
|
459
|
-
const tocDirPath = (0,
|
|
460
|
-
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);
|
|
461
427
|
let cache = {};
|
|
462
428
|
let found = [];
|
|
463
429
|
({
|
|
@@ -468,16 +434,16 @@ function includerFunction(params) {
|
|
|
468
434
|
nocase: true,
|
|
469
435
|
cache
|
|
470
436
|
}));
|
|
471
|
-
const writePath = (0,
|
|
437
|
+
const writePath = (0, import_path10.join)(writeBasePath, tocDirPath, item.include.path);
|
|
472
438
|
yield (0, import_promises2.mkdir)(writePath, { recursive: true });
|
|
473
439
|
for (const filePath of found) {
|
|
474
|
-
const file = yield (0, import_promises2.readFile)((0,
|
|
475
|
-
yield (0, import_promises2.mkdir)((0,
|
|
476
|
-
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);
|
|
477
443
|
}
|
|
478
444
|
const graph = createGraphFromPaths(found);
|
|
479
445
|
const toc = createToc(leadingPageName, item.include.path)(graph, []);
|
|
480
|
-
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));
|
|
481
447
|
} catch (err) {
|
|
482
448
|
throw new GenericIncluderError(err.toString(), tocPath);
|
|
483
449
|
}
|
|
@@ -509,8 +475,8 @@ function createToc(leadingPageName, tocName) {
|
|
|
509
475
|
return function createTocRec(graph, cursor) {
|
|
510
476
|
var _a, _b;
|
|
511
477
|
const handler = (file) => ({
|
|
512
|
-
name: (0,
|
|
513
|
-
href: (0,
|
|
478
|
+
name: (0, import_path10.parse)(file).name === "index" ? leadingPageName : file,
|
|
479
|
+
href: (0, import_path10.join)(...cursor, file)
|
|
514
480
|
});
|
|
515
481
|
const recurse = (key) => createTocRec(graph[key], [...cursor, key]);
|
|
516
482
|
const current = {
|
|
@@ -561,7 +527,7 @@ __export(unarchive_exports, {
|
|
|
561
527
|
name: () => name3
|
|
562
528
|
});
|
|
563
529
|
var import_fs = require("fs");
|
|
564
|
-
var
|
|
530
|
+
var import_path11 = require("path");
|
|
565
531
|
var import_tar_stream = require("tar-stream");
|
|
566
532
|
var name3 = "unarchive";
|
|
567
533
|
var UnarchiveIncluderError = class extends Error {
|
|
@@ -584,8 +550,8 @@ function pipeline(readPath, writeBasePath) {
|
|
|
584
550
|
(0, import_fs.mkdirSync)(writeBasePath, { recursive: true });
|
|
585
551
|
extractor.on("entry", (header, stream, next) => {
|
|
586
552
|
const { type, name: name4 } = header;
|
|
587
|
-
const writePath = (0,
|
|
588
|
-
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);
|
|
589
555
|
(0, import_fs.mkdirSync)(writeDirPath, { recursive: true });
|
|
590
556
|
if (type !== "directory") {
|
|
591
557
|
const writer = (0, import_fs.createWriteStream)(writePath, { flags: "w" });
|
|
@@ -616,8 +582,8 @@ function includerFunction3(params) {
|
|
|
616
582
|
if (!(input == null ? void 0 : input.length) || !(output == null ? void 0 : output.length)) {
|
|
617
583
|
throw new UnarchiveIncluderError("provide includer with input parameter", tocPath);
|
|
618
584
|
}
|
|
619
|
-
const contentPath = index === 0 ? (0,
|
|
620
|
-
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);
|
|
621
587
|
try {
|
|
622
588
|
yield pipeline(contentPath, writePath);
|
|
623
589
|
} catch (err) {
|
|
@@ -674,7 +640,7 @@ function applyIncluders(path, item, vars) {
|
|
|
674
640
|
const passedParams = __spreadValues({}, rest);
|
|
675
641
|
yield applyIncluder({ path, item, includer, passedParams, index, vars });
|
|
676
642
|
}
|
|
677
|
-
item.include.path = (0,
|
|
643
|
+
item.include.path = (0, import_path12.join)(item.include.path, "toc.yaml");
|
|
678
644
|
index++;
|
|
679
645
|
});
|
|
680
646
|
}
|
|
@@ -746,8 +712,8 @@ function add(path) {
|
|
|
746
712
|
ignoreStage,
|
|
747
713
|
vars
|
|
748
714
|
} = argv_default.getConfig();
|
|
749
|
-
const pathToDir = (0,
|
|
750
|
-
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");
|
|
751
717
|
const parsedToc = (0, import_js_yaml3.load)(content);
|
|
752
718
|
if (parsedToc.stage === ignoreStage) {
|
|
753
719
|
return;
|
|
@@ -764,16 +730,16 @@ function add(path) {
|
|
|
764
730
|
parsedToc.items = yield processTocItems(
|
|
765
731
|
path,
|
|
766
732
|
parsedToc.items,
|
|
767
|
-
(0,
|
|
768
|
-
(0,
|
|
733
|
+
(0, import_path13.join)(inputFolderPath, pathToDir),
|
|
734
|
+
(0, import_path13.resolve)(inputFolderPath),
|
|
769
735
|
combinedVars
|
|
770
736
|
);
|
|
771
737
|
storage.set(path, parsedToc);
|
|
772
738
|
parsedToc.base = pathToDir;
|
|
773
739
|
if (outputFormat === "md") {
|
|
774
|
-
const outputPath = (0,
|
|
740
|
+
const outputPath = (0, import_path13.resolve)(outputFolderPath, path);
|
|
775
741
|
const outputToc = (0, import_js_yaml3.dump)(parsedToc);
|
|
776
|
-
import_shelljs2.default.mkdir("-p", (0,
|
|
742
|
+
import_shelljs2.default.mkdir("-p", (0, import_path13.dirname)(outputPath));
|
|
777
743
|
(0, import_fs2.writeFileSync)(outputPath, outputToc);
|
|
778
744
|
}
|
|
779
745
|
prepareNavigationPaths(parsedToc, pathToDir);
|
|
@@ -816,7 +782,7 @@ function prepareNavigationPaths(parsedToc, dirPath) {
|
|
|
816
782
|
processItems(preparedSubItems, pathToDir);
|
|
817
783
|
}
|
|
818
784
|
if (item.href && !isExternalHref(item.href)) {
|
|
819
|
-
const href = (0,
|
|
785
|
+
const href = (0, import_path13.join)(pathToDir, item.href);
|
|
820
786
|
storage.set(href, parsedToc);
|
|
821
787
|
const navigationPath = _normalizeHref(href);
|
|
822
788
|
navigationPaths.push(navigationPath);
|
|
@@ -826,32 +792,32 @@ function prepareNavigationPaths(parsedToc, dirPath) {
|
|
|
826
792
|
processItems([parsedToc], dirPath);
|
|
827
793
|
}
|
|
828
794
|
function _normalizeHref(href) {
|
|
829
|
-
const preparedHref = (0,
|
|
795
|
+
const preparedHref = (0, import_path13.normalize)(href);
|
|
830
796
|
if (preparedHref.endsWith(".md") || preparedHref.endsWith(".yaml")) {
|
|
831
797
|
return preparedHref;
|
|
832
798
|
}
|
|
833
|
-
if (preparedHref.endsWith(
|
|
799
|
+
if (preparedHref.endsWith(import_path13.sep)) {
|
|
834
800
|
return `${preparedHref}index.yaml`;
|
|
835
801
|
}
|
|
836
802
|
return `${preparedHref}.md`;
|
|
837
803
|
}
|
|
838
804
|
function _copyTocDir(tocPath, destDir) {
|
|
839
805
|
const { input: inputFolderPath } = argv_default.getConfig();
|
|
840
|
-
const { dir: tocDir } = (0,
|
|
806
|
+
const { dir: tocDir } = (0, import_path13.parse)(tocPath);
|
|
841
807
|
const files = (0, import_walk_sync.default)(tocDir, {
|
|
842
808
|
globs: ["**/*.*"],
|
|
843
809
|
ignore: ["**/toc.yaml"],
|
|
844
810
|
directories: false
|
|
845
811
|
});
|
|
846
812
|
files.forEach((relPath) => {
|
|
847
|
-
const from = (0,
|
|
848
|
-
const to = (0,
|
|
849
|
-
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);
|
|
850
816
|
const isMdFile = fileExtension === ".md";
|
|
851
|
-
import_shelljs2.default.mkdir("-p", (0,
|
|
817
|
+
import_shelljs2.default.mkdir("-p", (0, import_path13.parse)(to).dir);
|
|
852
818
|
if (isMdFile) {
|
|
853
819
|
const fileContent = (0, import_fs2.readFileSync)(from, "utf8");
|
|
854
|
-
const sourcePath = (0,
|
|
820
|
+
const sourcePath = (0, import_path13.relative)(inputFolderPath, from);
|
|
855
821
|
const updatedFileContent = getContentWithUpdatedStaticMetadata({
|
|
856
822
|
fileContent,
|
|
857
823
|
sourcePath,
|
|
@@ -866,14 +832,14 @@ function _copyTocDir(tocPath, destDir) {
|
|
|
866
832
|
function _replaceIncludesHrefs(items, includeTocDir, tocDir) {
|
|
867
833
|
return items.reduce((acc, tocItem) => {
|
|
868
834
|
if (tocItem.href) {
|
|
869
|
-
tocItem.href = (0,
|
|
835
|
+
tocItem.href = (0, import_path13.relative)(tocDir, (0, import_path13.resolve)(includeTocDir, tocItem.href));
|
|
870
836
|
}
|
|
871
837
|
if (tocItem.items) {
|
|
872
838
|
tocItem.items = _replaceIncludesHrefs(tocItem.items, includeTocDir, tocDir);
|
|
873
839
|
}
|
|
874
840
|
if (tocItem.include) {
|
|
875
841
|
const { path } = tocItem.include;
|
|
876
|
-
tocItem.include.path = (0,
|
|
842
|
+
tocItem.include.path = (0, import_path13.relative)(tocDir, (0, import_path13.resolve)(includeTocDir, path));
|
|
877
843
|
}
|
|
878
844
|
return acc.concat(tocItem);
|
|
879
845
|
}, []);
|
|
@@ -897,7 +863,7 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
897
863
|
for (const item of items) {
|
|
898
864
|
let includedInlineItems = null;
|
|
899
865
|
if (item.name) {
|
|
900
|
-
const tocPath = (0,
|
|
866
|
+
const tocPath = (0, import_path13.join)(tocDir, "toc.yaml");
|
|
901
867
|
item.name = _liquidSubstitutions(item.name, vars, tocPath);
|
|
902
868
|
}
|
|
903
869
|
try {
|
|
@@ -911,8 +877,8 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
911
877
|
}
|
|
912
878
|
if (item.include) {
|
|
913
879
|
const { mode = "root_merge" /* ROOT_MERGE */ } = item.include;
|
|
914
|
-
const includeTocPath = mode === "root_merge" /* ROOT_MERGE */ ? (0,
|
|
915
|
-
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);
|
|
916
882
|
try {
|
|
917
883
|
const includeToc = (0, import_js_yaml3.load)((0, import_fs2.readFileSync)(includeTocPath, "utf8"));
|
|
918
884
|
if (includeToc.stage === "tech-preview" /* TECH_PREVIEW */) {
|
|
@@ -945,7 +911,7 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
945
911
|
}
|
|
946
912
|
} catch (err) {
|
|
947
913
|
const message = `Error while including toc: ${(0, import_chalk2.bold)(includeTocPath)} to ${(0, import_chalk2.bold)(
|
|
948
|
-
(0,
|
|
914
|
+
(0, import_path13.join)(tocDir, "toc.yaml")
|
|
949
915
|
)}`;
|
|
950
916
|
import_log2.default.error(message);
|
|
951
917
|
continue;
|
|
@@ -966,8 +932,8 @@ function _replaceIncludes(path, items, tocDir, sourcesDir, vars) {
|
|
|
966
932
|
}
|
|
967
933
|
function getTocDir(pagePath) {
|
|
968
934
|
const { input: inputFolderPath } = argv_default.getConfig();
|
|
969
|
-
const tocDir = (0,
|
|
970
|
-
const tocPath = (0,
|
|
935
|
+
const tocDir = (0, import_path13.dirname)(pagePath);
|
|
936
|
+
const tocPath = (0, import_path13.resolve)(tocDir, "toc.yaml");
|
|
971
937
|
if (!tocDir.includes(inputFolderPath)) {
|
|
972
938
|
throw new Error("Error while finding toc dir");
|
|
973
939
|
}
|
|
@@ -989,19 +955,19 @@ var tocs_default = {
|
|
|
989
955
|
};
|
|
990
956
|
|
|
991
957
|
// src/services/preset.ts
|
|
992
|
-
var
|
|
958
|
+
var import_path14 = require("path");
|
|
993
959
|
var presetStorage = /* @__PURE__ */ new Map();
|
|
994
960
|
function add2(parsedPreset, path, varsPreset) {
|
|
995
961
|
const combinedValues = __spreadValues(__spreadValues({}, parsedPreset.default || {}), parsedPreset[varsPreset] || {});
|
|
996
|
-
const key = (0,
|
|
962
|
+
const key = (0, import_path14.dirname)((0, import_path14.normalize)(path));
|
|
997
963
|
presetStorage.set(key, combinedValues);
|
|
998
964
|
}
|
|
999
965
|
function get(path) {
|
|
1000
966
|
let combinedValues = {};
|
|
1001
|
-
let localPath = (0,
|
|
967
|
+
let localPath = (0, import_path14.normalize)(path);
|
|
1002
968
|
while (localPath !== ".") {
|
|
1003
969
|
const presetValues = presetStorage.get(localPath) || {};
|
|
1004
|
-
localPath = (0,
|
|
970
|
+
localPath = (0, import_path14.dirname)(localPath);
|
|
1005
971
|
combinedValues = __spreadValues(__spreadValues({}, presetValues), combinedValues);
|
|
1006
972
|
}
|
|
1007
973
|
combinedValues = __spreadValues(__spreadValues({}, presetStorage.get(".")), combinedValues);
|
|
@@ -1021,7 +987,7 @@ var preset_default = {
|
|
|
1021
987
|
};
|
|
1022
988
|
|
|
1023
989
|
// src/services/argv.ts
|
|
1024
|
-
var
|
|
990
|
+
var import_path15 = require("path");
|
|
1025
991
|
var import_fs3 = require("fs");
|
|
1026
992
|
var _argv;
|
|
1027
993
|
function getConfig() {
|
|
@@ -1035,7 +1001,7 @@ function init2(argv) {
|
|
|
1035
1001
|
_argv.vars = JSON.parse(argv.vars);
|
|
1036
1002
|
}
|
|
1037
1003
|
try {
|
|
1038
|
-
const ignorefile = (0, import_fs3.readFileSync)((0,
|
|
1004
|
+
const ignorefile = (0, import_fs3.readFileSync)((0, import_path15.join)(_argv.rootInput, ".yfmignore"), "utf8");
|
|
1039
1005
|
const ignore = ignorefile.split("\n");
|
|
1040
1006
|
_argv.ignore = _argv.ignore.concat(ignore);
|
|
1041
1007
|
} catch (e) {
|
|
@@ -1051,7 +1017,7 @@ var argv_default = {
|
|
|
1051
1017
|
};
|
|
1052
1018
|
|
|
1053
1019
|
// src/services/leading.ts
|
|
1054
|
-
var
|
|
1020
|
+
var import_path16 = require("path");
|
|
1055
1021
|
var import_fs4 = require("fs");
|
|
1056
1022
|
var import_js_yaml4 = require("js-yaml");
|
|
1057
1023
|
var import_log3 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
@@ -1127,7 +1093,7 @@ function getDefaultLintConfig() {
|
|
|
1127
1093
|
|
|
1128
1094
|
// src/resolvers/md2md.ts
|
|
1129
1095
|
var import_fs5 = require("fs");
|
|
1130
|
-
var
|
|
1096
|
+
var import_path17 = require("path");
|
|
1131
1097
|
var import_shelljs3 = __toESM(require("shelljs"));
|
|
1132
1098
|
var import_log4 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
1133
1099
|
var import_liquid3 = __toESM(require("@diplodoc/transform/lib/liquid"));
|
|
@@ -1143,7 +1109,7 @@ function liquidMd2Md(input, vars, path) {
|
|
|
1143
1109
|
}
|
|
1144
1110
|
|
|
1145
1111
|
// src/resolvers/md2html.ts
|
|
1146
|
-
var
|
|
1112
|
+
var import_path18 = require("path");
|
|
1147
1113
|
var import_fs6 = require("fs");
|
|
1148
1114
|
var import_js_yaml5 = __toESM(require("js-yaml"));
|
|
1149
1115
|
var import_transform = __toESM(require("@diplodoc/transform"));
|
|
@@ -1158,7 +1124,7 @@ function liquidMd2Html(input, vars, path) {
|
|
|
1158
1124
|
}
|
|
1159
1125
|
|
|
1160
1126
|
// src/resolvers/lintPage.ts
|
|
1161
|
-
var
|
|
1127
|
+
var import_path19 = require("path");
|
|
1162
1128
|
var import_log6 = __toESM(require("@diplodoc/transform/lib/log"));
|
|
1163
1129
|
var import_yfmlint = __toESM(require("@diplodoc/transform/lib/yfmlint"));
|
|
1164
1130
|
var import_fs7 = require("fs");
|
|
@@ -1169,7 +1135,7 @@ var FileLinter = {
|
|
|
1169
1135
|
function lintPage(options) {
|
|
1170
1136
|
const { inputPath, fileExtension, onFinish } = options;
|
|
1171
1137
|
const { input } = argv_default.getConfig();
|
|
1172
|
-
const resolvedPath = (0,
|
|
1138
|
+
const resolvedPath = (0, import_path19.resolve)(input, inputPath);
|
|
1173
1139
|
try {
|
|
1174
1140
|
const content = (0, import_fs7.readFileSync)(resolvedPath, "utf8");
|
|
1175
1141
|
const lintFn = FileLinter[fileExtension];
|
|
@@ -1191,10 +1157,10 @@ function MdFileLinter(content, lintOptions) {
|
|
|
1191
1157
|
const { path: filePath } = lintOptions;
|
|
1192
1158
|
const plugins2 = outputFormat === "md" ? [] : plugins_exports.getPlugins();
|
|
1193
1159
|
const vars = getVarsPerFile(filePath);
|
|
1194
|
-
const root = (0,
|
|
1195
|
-
const path = (0,
|
|
1160
|
+
const root = (0, import_path19.resolve)(input);
|
|
1161
|
+
const path = (0, import_path19.resolve)(input, filePath);
|
|
1196
1162
|
let preparedContent = content;
|
|
1197
|
-
const assetsPublicPath = (0,
|
|
1163
|
+
const assetsPublicPath = (0, import_path19.relative)((0, import_path19.dirname)(path), root);
|
|
1198
1164
|
const lintMarkdown = function lintMarkdown2(opts) {
|
|
1199
1165
|
const { input: localInput, path: localPath, sourceMap: sourceMap2 } = opts;
|
|
1200
1166
|
const pluginOptions = __spreadProps(__spreadValues({}, options), {
|
|
@@ -1247,7 +1213,7 @@ function run(_0) {
|
|
|
1247
1213
|
tocs_default.getNavigationPaths().forEach((pathToFile) => {
|
|
1248
1214
|
lintPage({
|
|
1249
1215
|
inputPath: pathToFile,
|
|
1250
|
-
fileExtension: (0,
|
|
1216
|
+
fileExtension: (0, import_path20.extname)(pathToFile),
|
|
1251
1217
|
onFinish: () => {
|
|
1252
1218
|
processedPages.next(pathToFile);
|
|
1253
1219
|
}
|