@diplodoc/cli 4.19.2 → 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 CHANGED
@@ -8711,11 +8711,11 @@ var require_utilsFS = __commonJS2({
8711
8711
  }
8712
8712
  }
8713
8713
  exports2.isFileExists = isFileExists2;
8714
- function resolveRelativePath3(fromPath, relativePath) {
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 = resolveRelativePath3;
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 = resolveRelativePath3(path2, includePath);
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 = resolveRelativePath3(currentPath, pathname);
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: sep6 } = require("path");
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 && sep6);
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 (sep6 === "\\") {
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 sep6 = match2 ? match2[0] : "," + this.raw("between", "beforeOpen");
26980
- this.selector = values.join(sep6);
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":
@@ -142840,14 +142841,21 @@ function processAssetsMdRun({ args, tmpOutputFolder }) {
142840
142841
  return;
142841
142842
  }
142842
142843
  const contentLinks = findAllValuesByKeys(content, import_ssr2.LINK_KEYS);
142843
- const localMediaLinks = contentLinks.filter(
142844
- (link2) => new RegExp(/^\S.*\.(svg|png|gif|jpg|jpeg|bmp|webp|ico)$/gm).test(link2) && (0, import_utils14.isLocalUrl)(link2)
142845
- );
142846
- copyFiles(
142847
- args.input,
142848
- tmpOutputFolder,
142849
- localMediaLinks.filter((link2) => checkPathExists(link2, yamlFile))
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
+ []
142850
142857
  );
142858
+ copyFiles(args.input, tmpOutputFolder, localMediaLinks);
142851
142859
  });
142852
142860
  }
142853
142861
  function hasIntersection(array1, array2) {
@@ -147900,8 +147908,8 @@ var path = {
147900
147908
  win32: { sep: "\\" },
147901
147909
  posix: { sep: "/" }
147902
147910
  };
147903
- var sep5 = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
147904
- minimatch.sep = sep5;
147911
+ var sep6 = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
147912
+ minimatch.sep = sep6;
147905
147913
  var GLOBSTAR = Symbol("globstar **");
147906
147914
  minimatch.GLOBSTAR = GLOBSTAR;
147907
147915
  var qmark2 = "[^/]";
@@ -153615,7 +153623,7 @@ import_yargs.default.command(build).command(publish).command(translate).option("
153615
153623
  default: false,
153616
153624
  describe: "Run in quiet mode. Don't write logs to stdout",
153617
153625
  type: "boolean"
153618
- }).group(["config", "strict", "quiet", "help", "version"], "Common options:").version(true ? "4.19.2" : "").help().parse((0, import_helpers.hideBin)(process.argv), {}, (err, { strict }, output) => {
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) => {
153619
153627
  console.timeEnd(MAIN_TIMER_ID);
153620
153628
  if (err) {
153621
153629
  console.error(err);