honkit 3.7.0 → 3.7.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.
Files changed (172) hide show
  1. package/lib/__tests__/init.js +1 -1
  2. package/lib/__tests__/snapshot-honkit.js +1 -1
  3. package/lib/api/decodeGlobal.js +1 -1
  4. package/lib/api/encodeConfig.js +0 -4
  5. package/lib/api/encodeGlobal.js +9 -9
  6. package/lib/api/encodeNavigation.js +0 -4
  7. package/lib/api/encodePage.js +1 -5
  8. package/lib/api/encodeProgress.js +1 -6
  9. package/lib/api/encodeSummary.js +3 -5
  10. package/lib/bin.js +1 -1
  11. package/lib/cli/build.js +3 -3
  12. package/lib/cli/buildEbook.js +2 -2
  13. package/lib/cli/getBook.js +1 -1
  14. package/lib/cli/index.js +1 -1
  15. package/lib/cli/init.js +1 -1
  16. package/lib/cli/parse.js +1 -1
  17. package/lib/cli/serve.js +7 -7
  18. package/lib/cli/server.js +3 -3
  19. package/lib/constants/__tests__/configSchema.js +7 -7
  20. package/lib/constants/configDefault.js +1 -1
  21. package/lib/constants/defaultFilters.js +2 -2
  22. package/lib/fs/__tests__/mock.js +1 -1
  23. package/lib/index.js +1 -1
  24. package/lib/init.js +1 -1
  25. package/lib/json/encodeBook.js +5 -5
  26. package/lib/json/encodeBookWithPage.js +3 -3
  27. package/lib/json/encodeGlossary.js +1 -1
  28. package/lib/json/encodeLanguages.js +1 -1
  29. package/lib/json/encodeOutput.js +1 -1
  30. package/lib/json/encodeOutputWithPage.js +3 -3
  31. package/lib/json/encodePage.js +9 -8
  32. package/lib/json/encodeReadme.js +1 -1
  33. package/lib/json/encodeSummary.js +1 -1
  34. package/lib/json/encodeSummaryArticle.js +8 -1
  35. package/lib/json/encodeSummaryArticleWithCache.js +36 -0
  36. package/lib/models/__tests__/summaryArticle.js +55 -0
  37. package/lib/models/__tests__/templateBlock.js +2 -2
  38. package/lib/models/book.js +1 -1
  39. package/lib/models/config.js +1 -1
  40. package/lib/models/fs.js +5 -5
  41. package/lib/models/glossaryEntry.js +1 -1
  42. package/lib/models/ignore.js +2 -2
  43. package/lib/models/output.js +1 -1
  44. package/lib/models/page.js +1 -1
  45. package/lib/models/parser.js +11 -11
  46. package/lib/models/templateBlock.js +3 -3
  47. package/lib/modifiers/config/__tests__/addPlugin.js +1 -1
  48. package/lib/modifiers/config/__tests__/removePlugin.js +3 -3
  49. package/lib/modifiers/config/__tests__/togglePlugin.js +2 -2
  50. package/lib/modifiers/config/addPlugin.js +2 -2
  51. package/lib/modifiers/config/isDefaultPlugin.js +1 -1
  52. package/lib/modifiers/config/removePlugin.js +2 -2
  53. package/lib/modifiers/config/togglePlugin.js +1 -1
  54. package/lib/modifiers/summary/__tests__/editPartTitle.js +3 -3
  55. package/lib/modifiers/summary/__tests__/insertArticle.js +2 -2
  56. package/lib/modifiers/summary/__tests__/insertPart.js +2 -2
  57. package/lib/modifiers/summary/__tests__/mergeAtLevel.js +2 -2
  58. package/lib/modifiers/summary/__tests__/moveArticle.js +3 -3
  59. package/lib/modifiers/summary/__tests__/moveArticleAfter.js +5 -5
  60. package/lib/modifiers/summary/__tests__/removeArticle.js +1 -1
  61. package/lib/modifiers/summary/editArticleRef.js +1 -1
  62. package/lib/modifiers/summary/editArticleTitle.js +1 -1
  63. package/lib/modifiers/summary/indexPartLevels.js +1 -1
  64. package/lib/modifiers/summary/insertArticle.js +2 -2
  65. package/lib/modifiers/summary/insertPart.js +1 -1
  66. package/lib/modifiers/summary/moveArticle.js +2 -2
  67. package/lib/modifiers/summary/moveArticleAfter.js +4 -4
  68. package/lib/modifiers/summary/removeArticle.js +2 -2
  69. package/lib/modifiers/summary/removePart.js +1 -1
  70. package/lib/modifiers/summary/unshiftArticle.js +1 -1
  71. package/lib/output/Generator.js +2 -0
  72. package/lib/output/__tests__/ebook.js +1 -1
  73. package/lib/output/__tests__/json.js +3 -3
  74. package/lib/output/__tests__/plugin-hooks.js +3 -3
  75. package/lib/output/__tests__/website.js +8 -8
  76. package/lib/output/callHook.js +1 -1
  77. package/lib/output/callPageHook.js +1 -1
  78. package/lib/output/createTemplateEngine.js +1 -0
  79. package/lib/output/ebook/getConvertOptions.js +8 -8
  80. package/lib/output/ebook/getPDFTemplate.js +3 -1
  81. package/lib/output/ebook/index.js +1 -1
  82. package/lib/output/ebook/onFinish.js +3 -3
  83. package/lib/output/generateAssets.js +1 -1
  84. package/lib/output/generateBook.js +54 -46
  85. package/lib/output/generatePage.js +5 -5
  86. package/lib/output/generatePages.js +3 -3
  87. package/lib/output/getModifiers.js +2 -2
  88. package/lib/output/helper/fileToURL.js +1 -1
  89. package/lib/output/helper/resolveFileToURL.js +1 -1
  90. package/lib/output/index.js +0 -2
  91. package/lib/output/json/onFinish.js +1 -1
  92. package/lib/output/json/onPage.js +2 -2
  93. package/lib/output/modifiers/__tests__/addHeadingId.js +2 -2
  94. package/lib/output/modifiers/__tests__/annotateText.js +3 -3
  95. package/lib/output/modifiers/__tests__/fetchRemoteImages.js +2 -2
  96. package/lib/output/modifiers/__tests__/highlightCode.js +5 -5
  97. package/lib/output/modifiers/__tests__/inlinePng.js +1 -1
  98. package/lib/output/modifiers/__tests__/inlineSvg.js +2 -2
  99. package/lib/output/modifiers/__tests__/resolveImages.js +3 -3
  100. package/lib/output/modifiers/__tests__/resolveLinks.js +7 -7
  101. package/lib/output/modifiers/__tests__/svgToImg.js +2 -2
  102. package/lib/output/modifiers/addHeadingId.js +2 -2
  103. package/lib/output/modifiers/annotateText.js +1 -1
  104. package/lib/output/modifiers/fetchRemoteImages.js +1 -1
  105. package/lib/output/modifiers/highlightCode.js +2 -2
  106. package/lib/output/modifiers/inlineAssets.js +1 -1
  107. package/lib/output/modifiers/inlinePng.js +1 -1
  108. package/lib/output/modifiers/inlineSvg.js +1 -1
  109. package/lib/output/modifiers/resolveImages.js +1 -1
  110. package/lib/output/modifiers/resolveLinks.js +1 -1
  111. package/lib/output/modifiers/svgToImg.js +2 -2
  112. package/lib/output/preparePages.js +1 -1
  113. package/lib/output/preparePlugins.js +1 -1
  114. package/lib/output/testing/createMock.js +2 -2
  115. package/lib/output/testing/generateMock.js +3 -3
  116. package/lib/output/website/__tests__/i18n.js +6 -6
  117. package/lib/output/website/copyPluginAssets.js +4 -4
  118. package/lib/output/website/createTemplateEngine.js +7 -7
  119. package/lib/output/website/onFinish.js +3 -3
  120. package/lib/output/website/onInit.js +1 -1
  121. package/lib/output/website/onPage.js +5 -5
  122. package/lib/output/website/prepareI18n.js +2 -2
  123. package/lib/output/website/prepareResources.js +2 -2
  124. package/lib/output/website/state.js +1 -1
  125. package/lib/parse/__tests__/listAssets.js +6 -6
  126. package/lib/parse/__tests__/parseBook.js +6 -6
  127. package/lib/parse/__tests__/parseGlossary.js +4 -4
  128. package/lib/parse/__tests__/parseIgnore.js +2 -2
  129. package/lib/parse/__tests__/parsePageFromString.js +3 -3
  130. package/lib/parse/__tests__/parseReadme.js +5 -5
  131. package/lib/parse/__tests__/parseSummary.js +4 -4
  132. package/lib/parse/lookupStructureFile.js +1 -1
  133. package/lib/parse/parseBook.js +3 -3
  134. package/lib/parse/parseConfig.js +2 -2
  135. package/lib/parse/parseGlossary.js +1 -1
  136. package/lib/parse/parseIgnore.js +1 -1
  137. package/lib/parse/parseLanguages.js +1 -1
  138. package/lib/parse/parsePage.js +1 -1
  139. package/lib/parse/parsePageFromString.js +2 -2
  140. package/lib/parse/parsePagesList.js +2 -2
  141. package/lib/parse/parseReadme.js +1 -1
  142. package/lib/parse/parseStructureFile.js +1 -1
  143. package/lib/parse/parseSummary.js +1 -1
  144. package/lib/parse/validateConfig.js +2 -2
  145. package/lib/parse/walkSummary.js +1 -1
  146. package/lib/plugins/PluginResolver.js +5 -5
  147. package/lib/plugins/__tests__/findInstalled.js +1 -1
  148. package/lib/plugins/__tests__/listDependencies.js +6 -6
  149. package/lib/plugins/__tests__/sortDependencies.js +4 -4
  150. package/lib/plugins/__tests__/validatePlugin.js +3 -3
  151. package/lib/plugins/findInstalled.js +2 -2
  152. package/lib/plugins/listDependencies.js +1 -1
  153. package/lib/plugins/listDepsForBook.js +1 -1
  154. package/lib/plugins/loadForBook.js +2 -2
  155. package/lib/plugins/loadPlugin.js +2 -2
  156. package/lib/plugins/validateConfig.js +2 -2
  157. package/lib/plugins/validatePlugin.js +1 -1
  158. package/lib/templating/__tests__/conrefsLoader.js +11 -8
  159. package/lib/templating/__tests__/postRender.js +4 -4
  160. package/lib/templating/__tests__/replaceShortcuts.js +2 -2
  161. package/lib/templating/conrefsLoader.js +1 -1
  162. package/lib/templating/render.js +1 -1
  163. package/lib/templating/renderFile.js +2 -2
  164. package/lib/templating/replaceShortcuts.js +2 -2
  165. package/lib/templating/themesLoader.js +1 -1
  166. package/lib/utils/command.js +1 -33
  167. package/lib/utils/error.js +10 -10
  168. package/lib/utils/fs.js +6 -6
  169. package/lib/utils/git.js +4 -4
  170. package/lib/utils/promise.js +6 -6
  171. package/package.json +9 -8
  172. package/CHANGELOG.md +0 -448
@@ -12,44 +12,46 @@ describe("ConrefsLoader", () => {
12
12
  const fileName = path_1.default.join(dirName, "test.md");
13
13
  describe("Git", () => {
14
14
  const engine = new templateEngine_1.default({
15
+ // @ts-expect-error: Expected 0 arguments, but got 1.
15
16
  loader: new conrefsLoader_1.default(dirName),
16
17
  });
17
18
  test("should include content from git", () => {
18
19
  jest.setTimeout(20 * 1000);
19
20
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
20
- return render_1.default(engine, fileName, '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md" %}').then((out) => {
21
+ return (0, render_1.default)(engine, fileName, '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md" %}').then((out) => {
21
22
  expect(out.getContent()).toBe("Hello from git");
22
23
  });
23
24
  });
24
25
  test("should handle deep inclusion (1)", () => {
25
26
  jest.setTimeout(20 * 1000);
26
27
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
27
- return render_1.default(engine, fileName, '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test2.md" %}').then((out) => {
28
+ return (0, render_1.default)(engine, fileName, '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test2.md" %}').then((out) => {
28
29
  expect(out.getContent()).toBe("First Hello. Hello from git");
29
30
  });
30
31
  });
31
32
  test("should handle deep inclusion (2)", () => {
32
33
  jest.setTimeout(20 * 1000);
33
34
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
34
- return render_1.default(engine, fileName, '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test3.md" %}').then((out) => {
35
+ return (0, render_1.default)(engine, fileName, '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test3.md" %}').then((out) => {
35
36
  expect(out.getContent()).toBe("First Hello. Hello from git");
36
37
  });
37
38
  });
38
39
  });
39
40
  describe("Local", () => {
40
41
  const engine = new templateEngine_1.default({
42
+ // @ts-expect-error: Expected 0 arguments, but got 1.
41
43
  loader: new conrefsLoader_1.default(dirName),
42
44
  });
43
45
  describe("Relative", () => {
44
46
  test("should resolve basic relative filepath", () => {
45
47
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
46
- return render_1.default(engine, fileName, '{% include "include.md" %}').then((out) => {
48
+ return (0, render_1.default)(engine, fileName, '{% include "include.md" %}').then((out) => {
47
49
  expect(out.getContent()).toBe("Hello World");
48
50
  });
49
51
  });
50
52
  test("should resolve basic parent filepath", () => {
51
53
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
52
- return render_1.default(engine, path_1.default.join(dirName, "hello/test.md"), '{% include "../include.md" %}').then((out) => {
54
+ return (0, render_1.default)(engine, path_1.default.join(dirName, "hello/test.md"), '{% include "../include.md" %}').then((out) => {
53
55
  expect(out.getContent()).toBe("Hello World");
54
56
  });
55
57
  });
@@ -57,13 +59,13 @@ describe("ConrefsLoader", () => {
57
59
  describe("Absolute", () => {
58
60
  test("should resolve absolute filepath", () => {
59
61
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
60
- return render_1.default(engine, fileName, '{% include "/include.md" %}').then((out) => {
62
+ return (0, render_1.default)(engine, fileName, '{% include "/include.md" %}').then((out) => {
61
63
  expect(out.getContent()).toBe("Hello World");
62
64
  });
63
65
  });
64
66
  test("should resolve absolute filepath when in a directory", () => {
65
67
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
66
- return render_1.default(engine, path_1.default.join(dirName, "hello/test.md"), '{% include "/include.md" %}').then((out) => {
68
+ return (0, render_1.default)(engine, path_1.default.join(dirName, "hello/test.md"), '{% include "/include.md" %}').then((out) => {
67
69
  expect(out.getContent()).toBe("Hello World");
68
70
  });
69
71
  });
@@ -78,11 +80,12 @@ describe("ConrefsLoader", () => {
78
80
  return `test-${source}-endtest`;
79
81
  }
80
82
  const engine = new templateEngine_1.default({
83
+ // @ts-expect-error: Expected 0 arguments, but got 1.
81
84
  loader: new conrefsLoader_1.default(dirName, transform),
82
85
  });
83
86
  test("should transform included content", () => {
84
87
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
85
- return render_1.default(engine, fileName, '{% include "include.md" %}').then((out) => {
88
+ return (0, render_1.default)(engine, fileName, '{% include "include.md" %}').then((out) => {
86
89
  expect(out.getContent()).toBe("test-Hello World-endtest");
87
90
  });
88
91
  });
@@ -26,11 +26,11 @@ describe("postRender", () => {
26
26
  });
27
27
  test("should correctly replace block", () => {
28
28
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
29
- return render_1.default(engine, "README.md", "Hello {% lower %}Samy{% endlower %}")
29
+ return (0, render_1.default)(engine, "README.md", "Hello {% lower %}Samy{% endlower %}")
30
30
  .then((output) => {
31
31
  expect(output.getContent()).toMatch(/Hello \{\{\-([\S]+)\-\}\}/);
32
32
  expect(output.getBlocks().size).toBe(1);
33
- return postRender_1.default(engine, output);
33
+ return (0, postRender_1.default)(engine, output);
34
34
  })
35
35
  .then((result) => {
36
36
  expect(result).toBe("Hello samy");
@@ -38,11 +38,11 @@ describe("postRender", () => {
38
38
  });
39
39
  test("should correctly replace blocks", () => {
40
40
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
41
- return render_1.default(engine, "README.md", "Hello {% lower %}Samy{% endlower %}{% prefix %}Pesse{% endprefix %}")
41
+ return (0, render_1.default)(engine, "README.md", "Hello {% lower %}Samy{% endlower %}{% prefix %}Pesse{% endprefix %}")
42
42
  .then((output) => {
43
43
  expect(output.getContent()).toMatch(/Hello \{\{\-([\S]+)\-\}\}\{\{\-([\S]+)\-\}\}/);
44
44
  expect(output.getBlocks().size).toBe(2);
45
- return postRender_1.default(engine, output);
45
+ return (0, postRender_1.default)(engine, output);
46
46
  })
47
47
  .then((result) => {
48
48
  expect(result).toBe("Hello samy_Pesse_");
@@ -17,11 +17,11 @@ describe("replaceShortcuts", () => {
17
17
  }),
18
18
  ]);
19
19
  test("should correctly replace inline matches by block", () => {
20
- const content = replaceShortcuts_1.default(blocks, "test.md", "Hello $$a = b$$");
20
+ const content = (0, replaceShortcuts_1.default)(blocks, "test.md", "Hello $$a = b$$");
21
21
  expect(content).toBe("Hello {% math %}a = b{% endmath %}");
22
22
  });
23
23
  test("should correctly replace block matches", () => {
24
- const content = replaceShortcuts_1.default(blocks, "test.md", "Hello\n$$\na = b\n$$\n");
24
+ const content = (0, replaceShortcuts_1.default)(blocks, "test.md", "Hello\n$$\na = b\n$$\n");
25
25
  expect(content).toBe("Hello\n{% math %}\na = b\n{% endmath %}\n");
26
26
  });
27
27
  });
@@ -19,7 +19,6 @@ const path_2 = __importDefault(require("../utils/path"));
19
19
  * @param {Function(filePath, source)} transformFn (optional)
20
20
  * @param {Logger} logger (optional)
21
21
  */
22
- // @ts-expect-error: Property 'extend' does not exist on type 'typeof Loader'.
23
22
  const ConrefsLoader = nunjucks_1.default.Loader.extend({
24
23
  async: true,
25
24
  init: function (rootFolder, transformFn, logger) {
@@ -28,6 +27,7 @@ const ConrefsLoader = nunjucks_1.default.Loader.extend({
28
27
  this.logger = logger;
29
28
  this.git = new git_1.default();
30
29
  },
30
+ // @ts-expect-error: Property 'extend' does not exist on type 'typeof Loader'.
31
31
  getSource: function (sourceURL, callback) {
32
32
  const that = this;
33
33
  this.git
@@ -23,7 +23,7 @@ function renderTemplate(engine, filePath, content, context) {
23
23
  // Create nunjucks environment
24
24
  const env = engine.toNunjucks(blocks);
25
25
  // Replace shortcuts from plugin's blocks
26
- content = replaceShortcuts_1.default(engine.getBlocks(), filePath, content);
26
+ content = (0, replaceShortcuts_1.default)(engine.getBlocks(), filePath, content);
27
27
  return timing_1.default.measure("template.render", promise_1.default.nfcall(env.renderString.bind(env), content, context, {
28
28
  path: filePath,
29
29
  })
@@ -18,7 +18,7 @@ function renderTemplateFile(engine, filePath, context) {
18
18
  const loader = engine.getLoader();
19
19
  // Resolve the filePath
20
20
  const resolvedFilePath = loader.resolve(null, filePath);
21
- return promise_1.default()
21
+ return (0, promise_1.default)()
22
22
  .then(() => {
23
23
  if (!loader.async) {
24
24
  return loader.getSource(resolvedFilePath);
@@ -33,7 +33,7 @@ function renderTemplateFile(engine, filePath, context) {
33
33
  filename: filePath,
34
34
  });
35
35
  }
36
- return render_1.default(engine, result.path, result.src, context);
36
+ return (0, render_1.default)(engine, result.path, result.src, context);
37
37
  });
38
38
  }
39
39
  exports.default = renderTemplateFile;
@@ -16,7 +16,7 @@ function applyShortcut(content, shortcut) {
16
16
  const end = shortcut.getEnd();
17
17
  const tagStart = shortcut.getStartTag();
18
18
  const tagEnd = shortcut.getEndTag();
19
- const regex = new RegExp(`${escape_string_regexp_1.default(start)}([\\s\\S]*?[^\\$])${escape_string_regexp_1.default(end)}`, "g");
19
+ const regex = new RegExp(`${(0, escape_string_regexp_1.default)(start)}([\\s\\S]*?[^\\$])${(0, escape_string_regexp_1.default)(end)}`, "g");
20
20
  return content.replace(regex, (all, match) => {
21
21
  return `{% ${tagStart} %}${match}{% ${tagEnd} %}`;
22
22
  });
@@ -30,7 +30,7 @@ function applyShortcut(content, shortcut) {
30
30
  * @return {string}
31
31
  */
32
32
  function replaceShortcuts(blocks, filePath, content) {
33
- const shortcuts = listShortcuts_1.default(blocks, filePath);
33
+ const shortcuts = (0, listShortcuts_1.default)(blocks, filePath);
34
34
  return shortcuts.reduce(applyShortcut, content);
35
35
  }
36
36
  exports.default = replaceShortcuts;
@@ -8,8 +8,8 @@ const nunjucks_1 = __importDefault(require("nunjucks"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const path_2 = __importDefault(require("../utils/path"));
11
- // @ts-expect-error: Property 'extend' does not exist on type 'typeof Loader'.
12
11
  const ThemesLoader = nunjucks_1.default.Loader.extend({
12
+ // @ts-expect-error: Property 'extend' does not exist on type 'typeof Loader'.
13
13
  init: function (searchPaths) {
14
14
  this.searchPaths = immutable_1.default.List(searchPaths).map(path_1.default.normalize);
15
15
  },
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const is_1 = __importDefault(require("is"));
7
7
  const child_process_1 = __importDefault(require("child_process"));
8
- const spawn_cmd_1 = require("spawn-cmd");
9
8
  const promise_1 = __importDefault(require("./promise"));
10
9
  /**
11
10
  Execute a command
@@ -20,7 +19,7 @@ function exec(command, options) {
20
19
  if (!err) {
21
20
  return d.resolve();
22
21
  }
23
- err.message = stdout.toString("utf8") + stderr.toString("utf8");
22
+ err.message = stdout.toString() + stderr.toString();
24
23
  d.reject(err);
25
24
  });
26
25
  child.stdout.on("data", (data) => {
@@ -31,36 +30,6 @@ function exec(command, options) {
31
30
  });
32
31
  return d.promise;
33
32
  }
34
- /**
35
- Spawn an executable
36
-
37
- @param {string} command
38
- @param {Array} args
39
- @param {Object} options
40
- @return {Promise}
41
- */
42
- function spawnCmd(command, args, options) {
43
- const d = promise_1.default.defer();
44
- const child = spawn_cmd_1.spawn(command, args, options);
45
- child.on("error", (error) => {
46
- return d.reject(error);
47
- });
48
- child.stdout.on("data", (data) => {
49
- d.notify(data);
50
- });
51
- child.stderr.on("data", (data) => {
52
- d.notify(data);
53
- });
54
- child.on("close", (code) => {
55
- if (code === 0) {
56
- d.resolve();
57
- }
58
- else {
59
- d.reject(new Error(`Error with command "${command}"`));
60
- }
61
- });
62
- return d.promise;
63
- }
64
33
  /**
65
34
  Transform an option object to a command line string
66
35
 
@@ -99,6 +68,5 @@ function optionsToShellArgs(options) {
99
68
  }
100
69
  exports.default = {
101
70
  exec: exec,
102
- spawn: spawnCmd,
103
71
  optionsToShellArgs: optionsToShellArgs,
104
72
  };
@@ -14,28 +14,28 @@ function enforce(err) {
14
14
  return err;
15
15
  }
16
16
  // Random error wrappers during parsing/generation
17
- const ParsingError = wrapped_1.default({
17
+ const ParsingError = (0, wrapped_1.default)({
18
18
  message: "Parsing Error: {origMessage}",
19
19
  type: "parse",
20
20
  });
21
- const OutputError = wrapped_1.default({
21
+ const OutputError = (0, wrapped_1.default)({
22
22
  message: "Output Error: {origMessage}",
23
23
  type: "generate",
24
24
  });
25
25
  // A file does not exists
26
- const FileNotFoundError = typed_1.default({
26
+ const FileNotFoundError = (0, typed_1.default)({
27
27
  type: "file.not-found",
28
28
  message: 'No "{filename}" file (or is ignored)',
29
29
  filename: null,
30
30
  });
31
31
  // A file cannot be parsed
32
- const FileNotParsableError = typed_1.default({
32
+ const FileNotParsableError = (0, typed_1.default)({
33
33
  type: "file.not-parsable",
34
34
  message: '"{filename}" file cannot be parsed',
35
35
  filename: null,
36
36
  });
37
37
  // A file is outside the scope
38
- const FileOutOfScopeError = typed_1.default({
38
+ const FileOutOfScopeError = (0, typed_1.default)({
39
39
  type: "file.out-of-scope",
40
40
  message: '"{filename}" not in "{root}"',
41
41
  filename: null,
@@ -43,7 +43,7 @@ const FileOutOfScopeError = typed_1.default({
43
43
  code: "EACCESS",
44
44
  });
45
45
  // A file is outside the scope
46
- const RequireInstallError = typed_1.default({
46
+ const RequireInstallError = (0, typed_1.default)({
47
47
  type: "install.required",
48
48
  message: '"{cmd}" is not installed.\n{install}',
49
49
  cmd: null,
@@ -51,24 +51,24 @@ const RequireInstallError = typed_1.default({
51
51
  install: "",
52
52
  });
53
53
  // Error for nunjucks templates
54
- const TemplateError = wrapped_1.default({
54
+ const TemplateError = (0, wrapped_1.default)({
55
55
  message: 'Error compiling template "{filename}": {origMessage}',
56
56
  type: "template",
57
57
  filename: null,
58
58
  });
59
59
  // Error for nunjucks templates
60
- const PluginError = wrapped_1.default({
60
+ const PluginError = (0, wrapped_1.default)({
61
61
  message: 'Error with plugin "{plugin}": {origMessage}',
62
62
  type: "plugin",
63
63
  plugin: null,
64
64
  });
65
65
  // Error with the book's configuration
66
- const ConfigurationError = wrapped_1.default({
66
+ const ConfigurationError = (0, wrapped_1.default)({
67
67
  message: "Error with book's configuration: {origMessage}",
68
68
  type: "configuration",
69
69
  });
70
70
  // Error during ebook generation
71
- const EbookError = wrapped_1.default({
71
+ const EbookError = (0, wrapped_1.default)({
72
72
  message: "Error during ebook generation: {origMessage}\n{stdout}",
73
73
  type: "ebook",
74
74
  stdout: "",
package/lib/utils/fs.js CHANGED
@@ -17,7 +17,7 @@ function writeStream(filename, st) {
17
17
  const d = promise_1.default.defer();
18
18
  const wstream = fs_1.default.createWriteStream(filename);
19
19
  const cleanup = function () {
20
- destroy_1.default(wstream);
20
+ (0, destroy_1.default)(wstream);
21
21
  wstream.removeAllListeners();
22
22
  };
23
23
  wstream.on("finish", () => {
@@ -58,7 +58,7 @@ function genTmpDir(opts) {
58
58
  }
59
59
  // Download an image
60
60
  function download(uri, dest) {
61
- return writeStream(dest, request_1.default(uri));
61
+ return writeStream(dest, (0, request_1.default)(uri));
62
62
  }
63
63
  // Find a filename available in a folder
64
64
  function uniqueFilename(base, filename) {
@@ -71,12 +71,12 @@ function uniqueFilename(base, filename) {
71
71
  _filename = `${filename}_${i}${ext}`;
72
72
  i = i + 1;
73
73
  }
74
- return promise_1.default(path_1.default.relative(base, _filename));
74
+ return (0, promise_1.default)(path_1.default.relative(base, _filename));
75
75
  }
76
76
  // Create all required folder to create a file
77
77
  function ensureFile(filename) {
78
78
  const base = path_1.default.dirname(filename);
79
- return promise_1.default(mkdirp_1.default(base));
79
+ return (0, promise_1.default)((0, mkdirp_1.default)(base));
80
80
  }
81
81
  // Remove a folder
82
82
  function rmDir(base) {
@@ -121,10 +121,10 @@ function pickFile(rootFolder, fileName) {
121
121
  function ensureFolder(rootFolder) {
122
122
  return rmDir(rootFolder)
123
123
  .fail(() => {
124
- return promise_1.default();
124
+ return (0, promise_1.default)();
125
125
  })
126
126
  .then(() => {
127
- return promise_1.default(mkdirp_1.default(rootFolder));
127
+ return (0, promise_1.default)((0, mkdirp_1.default)(rootFolder));
128
128
  });
129
129
  }
130
130
  exports.default = {
package/lib/utils/git.js CHANGED
@@ -24,7 +24,7 @@ Git.prototype.repoID = function (host, ref) {
24
24
  Git.prototype.allocateDir = function () {
25
25
  const that = this;
26
26
  if (this.tmpDir)
27
- return promise_1.default();
27
+ return (0, promise_1.default)();
28
28
  // @ts-expect-error ts-migrate(2554) FIXME: Expected 1 arguments, but got 0.
29
29
  return fs_1.default.tmpDir().then((dir) => {
30
30
  that.tmpDir = dir;
@@ -61,13 +61,13 @@ Git.prototype.resolve = function (giturl) {
61
61
  // Path to a file in a git repo?
62
62
  if (!Git.isUrl(giturl)) {
63
63
  if (this.resolveRoot(giturl))
64
- return promise_1.default(giturl);
65
- return promise_1.default(null);
64
+ return (0, promise_1.default)(giturl);
65
+ return (0, promise_1.default)(null);
66
66
  }
67
67
  if (is_1.default.string(giturl))
68
68
  giturl = Git.parseUrl(giturl);
69
69
  if (!giturl)
70
- return promise_1.default(null);
70
+ return (0, promise_1.default)(null);
71
71
  // Clone or get from cache
72
72
  return this.clone(giturl.host, giturl.ref).then((repo) => {
73
73
  return path_1.default.resolve(repo, giturl.filepath);
@@ -24,7 +24,7 @@ function reduce(arr, iter, base) {
24
24
  return prev.then((val) => {
25
25
  return iter(val, elem, key);
26
26
  });
27
- }, q_1.default(base));
27
+ }, (0, q_1.default)(base));
28
28
  }
29
29
  exports.reduce = reduce;
30
30
  /**
@@ -50,7 +50,7 @@ exports.forEach = forEach;
50
50
  */
51
51
  function serie(arr, iter, base) {
52
52
  return reduce(arr, (before, item, key) => {
53
- return q_1.default(iter(item, key)).then((r) => {
53
+ return (0, q_1.default)(iter(item, key)).then((r) => {
54
54
  before.push(r);
55
55
  return before;
56
56
  });
@@ -72,7 +72,7 @@ function some(arr, iter) {
72
72
  return val;
73
73
  return iter(elem, i);
74
74
  });
75
- }, q_1.default());
75
+ }, (0, q_1.default)());
76
76
  }
77
77
  exports.some = some;
78
78
  /**
@@ -84,7 +84,7 @@ exports.some = some;
84
84
  */
85
85
  function mapAsList(arr, iter) {
86
86
  return reduce(arr, (prev, entry, i) => {
87
- return q_1.default(iter(entry, i)).then((out) => {
87
+ return (0, q_1.default)(iter(entry, i)).then((out) => {
88
88
  prev.push(out);
89
89
  return prev;
90
90
  });
@@ -104,7 +104,7 @@ function map(arr, iter) {
104
104
  type = "OrderedMap";
105
105
  }
106
106
  return mapAsList(arr, (value, key) => {
107
- return q_1.default(iter(value, key)).then((result) => {
107
+ return (0, q_1.default)(iter(value, key)).then((result) => {
108
108
  return [key, result];
109
109
  });
110
110
  }).then((result) => {
@@ -127,7 +127,7 @@ exports.map = map;
127
127
  function wrap(func) {
128
128
  return function () {
129
129
  const args = Array.prototype.slice.call(arguments, 0);
130
- return q_1.default().then(() => {
130
+ return (0, q_1.default)().then(() => {
131
131
  return func.apply(null, args);
132
132
  });
133
133
  };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "honkit",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "description": "HonKit is building beautiful books using Markdown.",
5
5
  "keywords": [
6
6
  "git",
7
+ "markdown",
7
8
  "book",
8
9
  "honkit",
9
10
  "gitbook"
@@ -46,10 +47,10 @@
46
47
  "updateSnapshot": "jest src -u"
47
48
  },
48
49
  "dependencies": {
49
- "@honkit/asciidoc": "^3.7.0",
50
- "@honkit/honkit-plugin-highlight": "^3.7.0",
51
- "@honkit/honkit-plugin-theme-default": "^3.7.0",
52
- "@honkit/markdown-legacy": "^3.7.0",
50
+ "@honkit/asciidoc": "^3.6.17",
51
+ "@honkit/honkit-plugin-highlight": "^3.6.19",
52
+ "@honkit/honkit-plugin-theme-default": "^3.6.20",
53
+ "@honkit/markdown-legacy": "^3.6.17",
53
54
  "bash-color": "^0.0.4",
54
55
  "cheerio": "^0.20.0",
55
56
  "chokidar": "^3.3.0",
@@ -80,6 +81,7 @@
80
81
  "json-schema-defaults": "^0.1.1",
81
82
  "jsonschema": "1.1.0",
82
83
  "juice": "^6.0.0",
84
+ "lru_map": "^0.4.1",
83
85
  "memoize-one": "^5.1.1",
84
86
  "mkdirp": "^1.0.4",
85
87
  "moment": "^2.24.0",
@@ -94,19 +96,18 @@
94
96
  "resolve": "^1.17.0",
95
97
  "semver": "^5.1.0",
96
98
  "send": "^0.17.1",
97
- "spawn-cmd": "0.0.2",
98
99
  "tiny-lr": "^1.1.1",
99
100
  "tmp": "0.0.28",
100
101
  "try-resolve": "^1.0.1",
101
102
  "urijs": "^1.19.6"
102
103
  },
103
104
  "devDependencies": {
104
- "@honkit/internal-test-utils": "^3.7.0",
105
+ "@honkit/internal-test-utils": "^3.6.17",
105
106
  "@types/nunjucks": "^3.1.3",
106
107
  "cross-env": "^7.0.3",
107
108
  "jest": "^26.6.3",
108
109
  "rimraf": "^3.0.2",
109
110
  "typescript": "^4.1.3"
110
111
  },
111
- "gitHead": "6091347c5a858a590bf0e2efb3716e56a22a626f"
112
+ "gitHead": "35d95d4d0b9f28dce4a4ac8cd3feb39c12ec1d1b"
112
113
  }