@diplodoc/cli 4.19.1 → 4.19.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 +36 -27
- package/build/index.js.map +3 -3
- package/package.json +4 -4
- package/src/steps/processAssets.ts +30 -19
package/build/index.js
CHANGED
|
@@ -8711,11 +8711,11 @@ var require_utilsFS = __commonJS2({
|
|
|
8711
8711
|
}
|
|
8712
8712
|
}
|
|
8713
8713
|
exports2.isFileExists = isFileExists2;
|
|
8714
|
-
function
|
|
8714
|
+
function resolveRelativePath4(fromPath, relativePath) {
|
|
8715
8715
|
const { dir: fromDir } = (0, path_1.parse)(fromPath);
|
|
8716
8716
|
return (0, path_1.resolve)(fromDir, relativePath);
|
|
8717
8717
|
}
|
|
8718
|
-
exports2.resolveRelativePath =
|
|
8718
|
+
exports2.resolveRelativePath = resolveRelativePath4;
|
|
8719
8719
|
function getFileTokens(path2, state, options) {
|
|
8720
8720
|
const { getVarsPerFile: getVarsPerFile2, vars, disableLiquid, disableLint, lintMarkdown, disableTitleRefSubstitution, disableCircularError, inheritVars = true, conditionsInCode } = options;
|
|
8721
8721
|
let content;
|
|
@@ -8757,7 +8757,7 @@ var require_utilsFS = __commonJS2({
|
|
|
8757
8757
|
if (includePath.startsWith(path_1.sep)) {
|
|
8758
8758
|
fullIncludePath = (0, path_1.join)(root, includePath);
|
|
8759
8759
|
} else {
|
|
8760
|
-
fullIncludePath =
|
|
8760
|
+
fullIncludePath = resolveRelativePath4(path2, includePath);
|
|
8761
8761
|
}
|
|
8762
8762
|
return fullIncludePath;
|
|
8763
8763
|
};
|
|
@@ -8766,7 +8766,7 @@ var require_utilsFS = __commonJS2({
|
|
|
8766
8766
|
const { root, currentPath, pathname, hash } = args;
|
|
8767
8767
|
let resultAnchor = currentPath;
|
|
8768
8768
|
if (pathname) {
|
|
8769
|
-
resultAnchor =
|
|
8769
|
+
resultAnchor = resolveRelativePath4(currentPath, pathname);
|
|
8770
8770
|
}
|
|
8771
8771
|
resultAnchor = resultAnchor.replace(root, "").replace(/\.(md|ya?ml|html)$/i, "").replace(new RegExp((0, escapeRegExp_1.default)(path_1.sep), "gi"), "_");
|
|
8772
8772
|
if (hash) {
|
|
@@ -25950,11 +25950,11 @@ var require_map_generator = __commonJS2({
|
|
|
25950
25950
|
"node_modules/postcss/lib/map-generator.js"(exports2, module2) {
|
|
25951
25951
|
"use strict";
|
|
25952
25952
|
var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
|
|
25953
|
-
var { dirname: dirname22, relative: relative10, resolve: resolve22, sep:
|
|
25953
|
+
var { dirname: dirname22, relative: relative10, resolve: resolve22, sep: sep7 } = require("path");
|
|
25954
25954
|
var { pathToFileURL } = require("url");
|
|
25955
25955
|
var Input = require_input();
|
|
25956
25956
|
var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
|
25957
|
-
var pathAvailable = Boolean(dirname22 && resolve22 && relative10 &&
|
|
25957
|
+
var pathAvailable = Boolean(dirname22 && resolve22 && relative10 && sep7);
|
|
25958
25958
|
var MapGenerator = class {
|
|
25959
25959
|
constructor(stringify6, root, opts, cssString) {
|
|
25960
25960
|
this.stringify = stringify6;
|
|
@@ -26263,7 +26263,7 @@ var require_map_generator = __commonJS2({
|
|
|
26263
26263
|
let cached = this.memoizedURLs.get(path2);
|
|
26264
26264
|
if (cached)
|
|
26265
26265
|
return cached;
|
|
26266
|
-
if (
|
|
26266
|
+
if (sep7 === "\\") {
|
|
26267
26267
|
path2 = path2.replace(/\\/g, "/");
|
|
26268
26268
|
}
|
|
26269
26269
|
let url3 = encodeURI(path2).replace(/[#?]/g, encodeURIComponent);
|
|
@@ -26976,8 +26976,8 @@ var require_rule = __commonJS2({
|
|
|
26976
26976
|
}
|
|
26977
26977
|
set selectors(values) {
|
|
26978
26978
|
let match2 = this.selector ? this.selector.match(/,\s*/) : null;
|
|
26979
|
-
let
|
|
26980
|
-
this.selector = values.join(
|
|
26979
|
+
let sep7 = match2 ? match2[0] : "," + this.raw("between", "beforeOpen");
|
|
26980
|
+
this.selector = values.join(sep7);
|
|
26981
26981
|
}
|
|
26982
26982
|
};
|
|
26983
26983
|
module2.exports = Rule;
|
|
@@ -142783,6 +142783,7 @@ var import_shelljs3 = __toESM2(require("shelljs"));
|
|
|
142783
142783
|
var import_path20 = require("path");
|
|
142784
142784
|
var import_ssr2 = require("@diplodoc/client/ssr");
|
|
142785
142785
|
var import_utils14 = __toESM2(require_utils2());
|
|
142786
|
+
var import_utilsFS3 = __toESM2(require_utilsFS());
|
|
142786
142787
|
function processAssets({ args, outputFormat, outputBundlePath, tmpOutputFolder }) {
|
|
142787
142788
|
switch (outputFormat) {
|
|
142788
142789
|
case "html":
|
|
@@ -142810,7 +142811,7 @@ function processAssetsHtmlRun({ outputBundlePath }) {
|
|
|
142810
142811
|
copyFiles(ASSETS_FOLDER, outputBundlePath, bundleAssetFilePath);
|
|
142811
142812
|
}
|
|
142812
142813
|
function processAssetsMdRun({ args, tmpOutputFolder }) {
|
|
142813
|
-
const { allowCustomResources, resources } = argv_default2.getConfig();
|
|
142814
|
+
const { input: inputFolderPath, allowCustomResources, resources } = argv_default2.getConfig();
|
|
142814
142815
|
const pathToConfig = args.config || (0, import_path20.join)(args.input, YFM_CONFIG_FILENAME);
|
|
142815
142816
|
const pathToRedirects = (0, import_path20.join)(args.input, REDIRECTS_FILENAME);
|
|
142816
142817
|
const pathToLintConfig = (0, import_path20.join)(args.input, LINT_CONFIG_FILENAME);
|
|
@@ -142827,26 +142828,34 @@ function processAssetsMdRun({ args, tmpOutputFolder }) {
|
|
|
142827
142828
|
);
|
|
142828
142829
|
copyFiles(args.input, tmpOutputFolder, resourcePaths);
|
|
142829
142830
|
}
|
|
142830
|
-
const
|
|
142831
|
-
|
|
142832
|
-
|
|
142833
|
-
|
|
142834
|
-
|
|
142835
|
-
|
|
142836
|
-
|
|
142831
|
+
const tocYamlFiles = tocs_default.getNavigationPaths().reduce((acc, file) => {
|
|
142832
|
+
if (file.endsWith(".yaml")) {
|
|
142833
|
+
const resolvedPathToFile = (0, import_path20.resolve)(inputFolderPath, file);
|
|
142834
|
+
acc.push(resolvedPathToFile);
|
|
142835
|
+
}
|
|
142836
|
+
return acc;
|
|
142837
|
+
}, []);
|
|
142838
|
+
tocYamlFiles.forEach((yamlFile) => {
|
|
142837
142839
|
const content = load((0, import_fs7.readFileSync)(yamlFile, "utf8"));
|
|
142838
142840
|
if (!Object.prototype.hasOwnProperty.call(content, "blocks")) {
|
|
142839
142841
|
return;
|
|
142840
142842
|
}
|
|
142841
142843
|
const contentLinks = findAllValuesByKeys(content, import_ssr2.LINK_KEYS);
|
|
142842
|
-
const localMediaLinks = contentLinks.
|
|
142843
|
-
(link2) =>
|
|
142844
|
-
|
|
142845
|
-
|
|
142846
|
-
|
|
142847
|
-
|
|
142848
|
-
|
|
142844
|
+
const localMediaLinks = contentLinks.reduce(
|
|
142845
|
+
(acc, link2) => {
|
|
142846
|
+
const linkHasMediaExt = new RegExp(
|
|
142847
|
+
/^\S.*\.(svg|png|gif|jpg|jpeg|bmp|webp|ico)$/gm
|
|
142848
|
+
).test(link2);
|
|
142849
|
+
if (linkHasMediaExt && (0, import_utils14.isLocalUrl)(link2) && checkPathExists(link2, yamlFile)) {
|
|
142850
|
+
const linkAbsolutePath = (0, import_utilsFS3.resolveRelativePath)(yamlFile, link2);
|
|
142851
|
+
const linkRootPath = linkAbsolutePath.replace(`${inputFolderPath}${import_path20.sep}`, "");
|
|
142852
|
+
acc.push(linkRootPath);
|
|
142853
|
+
}
|
|
142854
|
+
return acc;
|
|
142855
|
+
},
|
|
142856
|
+
[]
|
|
142849
142857
|
);
|
|
142858
|
+
copyFiles(args.input, tmpOutputFolder, localMediaLinks);
|
|
142850
142859
|
});
|
|
142851
142860
|
}
|
|
142852
142861
|
function hasIntersection(array1, array2) {
|
|
@@ -147899,8 +147908,8 @@ var path = {
|
|
|
147899
147908
|
win32: { sep: "\\" },
|
|
147900
147909
|
posix: { sep: "/" }
|
|
147901
147910
|
};
|
|
147902
|
-
var
|
|
147903
|
-
minimatch.sep =
|
|
147911
|
+
var sep6 = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
147912
|
+
minimatch.sep = sep6;
|
|
147904
147913
|
var GLOBSTAR = Symbol("globstar **");
|
|
147905
147914
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
147906
147915
|
var qmark2 = "[^/]";
|
|
@@ -153614,7 +153623,7 @@ import_yargs.default.command(build).command(publish).command(translate).option("
|
|
|
153614
153623
|
default: false,
|
|
153615
153624
|
describe: "Run in quiet mode. Don't write logs to stdout",
|
|
153616
153625
|
type: "boolean"
|
|
153617
|
-
}).group(["config", "strict", "quiet", "help", "version"], "Common options:").version(true ? "4.19.
|
|
153626
|
+
}).group(["config", "strict", "quiet", "help", "version"], "Common options:").version(true ? "4.19.3" : "").help().parse((0, import_helpers.hideBin)(process.argv), {}, (err, { strict }, output) => {
|
|
153618
153627
|
console.timeEnd(MAIN_TIMER_ID);
|
|
153619
153628
|
if (err) {
|
|
153620
153629
|
console.error(err);
|