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