honkit 6.0.3 → 6.1.4

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 (183) hide show
  1. package/lib/__tests__/__fixtures__/honkit/book.d.ts +7 -0
  2. package/lib/__tests__/__fixtures__/honkit/book.d.ts.map +1 -0
  3. package/lib/__tests__/__fixtures__/honkit/book.js +9 -0
  4. package/lib/__tests__/e2e.test.d.ts +2 -0
  5. package/lib/__tests__/e2e.test.d.ts.map +1 -0
  6. package/lib/__tests__/e2e.test.js +81 -0
  7. package/lib/__tests__/init.d.ts +2 -0
  8. package/lib/__tests__/init.d.ts.map +1 -0
  9. package/lib/__tests__/init.js +19 -0
  10. package/lib/__tests__/satisfies.d.ts +2 -0
  11. package/lib/__tests__/satisfies.d.ts.map +1 -0
  12. package/lib/__tests__/satisfies.js +11 -0
  13. package/lib/__tests__/snapshot-asciidoc.d.ts +2 -0
  14. package/lib/__tests__/snapshot-asciidoc.d.ts.map +1 -0
  15. package/lib/__tests__/snapshot-asciidoc.js +48 -0
  16. package/lib/__tests__/snapshot-honkit.d.ts +2 -0
  17. package/lib/__tests__/snapshot-honkit.d.ts.map +1 -0
  18. package/lib/__tests__/snapshot-honkit.js +48 -0
  19. package/lib/cli/server.d.ts.map +1 -1
  20. package/lib/constants/__tests__/configSchema.d.ts +2 -0
  21. package/lib/constants/__tests__/configSchema.d.ts.map +1 -0
  22. package/lib/constants/__tests__/configSchema.js +41 -0
  23. package/lib/fs/__tests__/mock.d.ts +2 -0
  24. package/lib/fs/__tests__/mock.d.ts.map +1 -0
  25. package/lib/fs/__tests__/mock.js +68 -0
  26. package/lib/models/__tests__/config.d.ts +2 -0
  27. package/lib/models/__tests__/config.d.ts.map +1 -0
  28. package/lib/models/__tests__/config.js +164 -0
  29. package/lib/models/__tests__/glossary.d.ts +2 -0
  30. package/lib/models/__tests__/glossary.d.ts.map +1 -0
  31. package/lib/models/__tests__/glossary.js +38 -0
  32. package/lib/models/__tests__/glossaryEntry.d.ts +2 -0
  33. package/lib/models/__tests__/glossaryEntry.d.ts.map +1 -0
  34. package/lib/models/__tests__/glossaryEntry.js +16 -0
  35. package/lib/models/__tests__/page.d.ts +2 -0
  36. package/lib/models/__tests__/page.d.ts.map +1 -0
  37. package/lib/models/__tests__/page.js +26 -0
  38. package/lib/models/__tests__/plugin.d.ts +2 -0
  39. package/lib/models/__tests__/plugin.d.ts.map +1 -0
  40. package/lib/models/__tests__/plugin.js +50 -0
  41. package/lib/models/__tests__/pluginDependency.d.ts +2 -0
  42. package/lib/models/__tests__/pluginDependency.d.ts.map +1 -0
  43. package/lib/models/__tests__/pluginDependency.js +71 -0
  44. package/lib/models/__tests__/summary.d.ts +2 -0
  45. package/lib/models/__tests__/summary.d.ts.map +1 -0
  46. package/lib/models/__tests__/summary.js +115 -0
  47. package/lib/models/__tests__/summaryArticle.d.ts +2 -0
  48. package/lib/models/__tests__/summaryArticle.d.ts.map +1 -0
  49. package/lib/models/__tests__/summaryArticle.js +117 -0
  50. package/lib/models/__tests__/summaryPart.d.ts +2 -0
  51. package/lib/models/__tests__/summaryPart.d.ts.map +1 -0
  52. package/lib/models/__tests__/summaryPart.js +24 -0
  53. package/lib/models/__tests__/templateBlock.d.ts +2 -0
  54. package/lib/models/__tests__/templateBlock.d.ts.map +1 -0
  55. package/lib/models/__tests__/templateBlock.js +172 -0
  56. package/lib/models/__tests__/templateEngine.d.ts +2 -0
  57. package/lib/models/__tests__/templateEngine.d.ts.map +1 -0
  58. package/lib/models/__tests__/templateEngine.js +49 -0
  59. package/lib/models/pluginDependency.d.ts.map +1 -1
  60. package/lib/modifiers/config/__tests__/addPlugin.d.ts +2 -0
  61. package/lib/modifiers/config/__tests__/addPlugin.d.ts.map +1 -0
  62. package/lib/modifiers/config/__tests__/addPlugin.js +30 -0
  63. package/lib/modifiers/config/__tests__/removePlugin.d.ts +2 -0
  64. package/lib/modifiers/config/__tests__/removePlugin.d.ts.map +1 -0
  65. package/lib/modifiers/config/__tests__/removePlugin.js +29 -0
  66. package/lib/modifiers/config/__tests__/togglePlugin.d.ts +2 -0
  67. package/lib/modifiers/config/__tests__/togglePlugin.d.ts.map +1 -0
  68. package/lib/modifiers/config/__tests__/togglePlugin.js +28 -0
  69. package/lib/modifiers/summary/__tests__/editPartTitle.d.ts +2 -0
  70. package/lib/modifiers/summary/__tests__/editPartTitle.d.ts.map +1 -0
  71. package/lib/modifiers/summary/__tests__/editPartTitle.js +41 -0
  72. package/lib/modifiers/summary/__tests__/insertArticle.d.ts +2 -0
  73. package/lib/modifiers/summary/__tests__/insertArticle.d.ts.map +1 -0
  74. package/lib/modifiers/summary/__tests__/insertArticle.js +72 -0
  75. package/lib/modifiers/summary/__tests__/insertPart.d.ts +2 -0
  76. package/lib/modifiers/summary/__tests__/insertPart.d.ts.map +1 -0
  77. package/lib/modifiers/summary/__tests__/insertPart.js +56 -0
  78. package/lib/modifiers/summary/__tests__/mergeAtLevel.d.ts +2 -0
  79. package/lib/modifiers/summary/__tests__/mergeAtLevel.d.ts.map +1 -0
  80. package/lib/modifiers/summary/__tests__/mergeAtLevel.js +45 -0
  81. package/lib/modifiers/summary/__tests__/moveArticle.d.ts +2 -0
  82. package/lib/modifiers/summary/__tests__/moveArticle.d.ts.map +1 -0
  83. package/lib/modifiers/summary/__tests__/moveArticle.js +66 -0
  84. package/lib/modifiers/summary/__tests__/moveArticleAfter.d.ts +2 -0
  85. package/lib/modifiers/summary/__tests__/moveArticleAfter.d.ts.map +1 -0
  86. package/lib/modifiers/summary/__tests__/moveArticleAfter.js +75 -0
  87. package/lib/modifiers/summary/__tests__/removeArticle.d.ts +2 -0
  88. package/lib/modifiers/summary/__tests__/removeArticle.d.ts.map +1 -0
  89. package/lib/modifiers/summary/__tests__/removeArticle.js +54 -0
  90. package/lib/output/__tests__/ebook.d.ts +2 -0
  91. package/lib/output/__tests__/ebook.d.ts.map +1 -0
  92. package/lib/output/__tests__/ebook.js +17 -0
  93. package/lib/output/__tests__/json.d.ts +2 -0
  94. package/lib/output/__tests__/json.d.ts.map +1 -0
  95. package/lib/output/__tests__/json.js +43 -0
  96. package/lib/output/__tests__/plugin-hooks.d.ts +2 -0
  97. package/lib/output/__tests__/plugin-hooks.d.ts.map +1 -0
  98. package/lib/output/__tests__/plugin-hooks.js +57 -0
  99. package/lib/output/__tests__/website.d.ts +2 -0
  100. package/lib/output/__tests__/website.d.ts.map +1 -0
  101. package/lib/output/__tests__/website.js +121 -0
  102. package/lib/output/generatePages.d.ts.map +1 -1
  103. package/lib/output/modifiers/__tests__/addHeadingId.d.ts +2 -0
  104. package/lib/output/modifiers/__tests__/addHeadingId.d.ts.map +1 -0
  105. package/lib/output/modifiers/__tests__/addHeadingId.js +23 -0
  106. package/lib/output/modifiers/__tests__/annotateText.d.ts +2 -0
  107. package/lib/output/modifiers/__tests__/annotateText.d.ts.map +1 -0
  108. package/lib/output/modifiers/__tests__/annotateText.js +71 -0
  109. package/lib/output/modifiers/__tests__/fetchRemoteImages.d.ts +2 -0
  110. package/lib/output/modifiers/__tests__/fetchRemoteImages.d.ts.map +1 -0
  111. package/lib/output/modifiers/__tests__/fetchRemoteImages.js +69 -0
  112. package/lib/output/modifiers/__tests__/highlightCode.d.ts +2 -0
  113. package/lib/output/modifiers/__tests__/highlightCode.d.ts.map +1 -0
  114. package/lib/output/modifiers/__tests__/highlightCode.js +48 -0
  115. package/lib/output/modifiers/__tests__/inlinePng.d.ts +2 -0
  116. package/lib/output/modifiers/__tests__/inlinePng.d.ts.map +1 -0
  117. package/lib/output/modifiers/__tests__/inlinePng.js +22 -0
  118. package/lib/output/modifiers/__tests__/inlineSvg.d.ts +2 -0
  119. package/lib/output/modifiers/__tests__/inlineSvg.d.ts.map +1 -0
  120. package/lib/output/modifiers/__tests__/inlineSvg.js +42 -0
  121. package/lib/output/modifiers/__tests__/resolveImages.d.ts +2 -0
  122. package/lib/output/modifiers/__tests__/resolveImages.d.ts.map +1 -0
  123. package/lib/output/modifiers/__tests__/resolveImages.js +39 -0
  124. package/lib/output/modifiers/__tests__/resolveLinks.d.ts +2 -0
  125. package/lib/output/modifiers/__tests__/resolveLinks.d.ts.map +1 -0
  126. package/lib/output/modifiers/__tests__/resolveLinks.js +81 -0
  127. package/lib/output/modifiers/__tests__/svgToImg.d.ts +2 -0
  128. package/lib/output/modifiers/__tests__/svgToImg.d.ts.map +1 -0
  129. package/lib/output/modifiers/__tests__/svgToImg.js +29 -0
  130. package/lib/output/website/__tests__/i18n.d.ts +2 -0
  131. package/lib/output/website/__tests__/i18n.d.ts.map +1 -0
  132. package/lib/output/website/__tests__/i18n.js +40 -0
  133. package/lib/parse/__tests__/listAssets.d.ts +2 -0
  134. package/lib/parse/__tests__/listAssets.d.ts.map +1 -0
  135. package/lib/parse/__tests__/listAssets.js +63 -0
  136. package/lib/parse/__tests__/parseBook.d.ts +2 -0
  137. package/lib/parse/__tests__/parseBook.d.ts.map +1 -0
  138. package/lib/parse/__tests__/parseBook.js +77 -0
  139. package/lib/parse/__tests__/parseGlossary.d.ts +2 -0
  140. package/lib/parse/__tests__/parseGlossary.d.ts.map +1 -0
  141. package/lib/parse/__tests__/parseGlossary.js +32 -0
  142. package/lib/parse/__tests__/parseIgnore.d.ts +2 -0
  143. package/lib/parse/__tests__/parseIgnore.d.ts.map +1 -0
  144. package/lib/parse/__tests__/parseIgnore.js +37 -0
  145. package/lib/parse/__tests__/parsePageFromString.d.ts +2 -0
  146. package/lib/parse/__tests__/parsePageFromString.d.ts.map +1 -0
  147. package/lib/parse/__tests__/parsePageFromString.js +34 -0
  148. package/lib/parse/__tests__/parseReadme.d.ts +2 -0
  149. package/lib/parse/__tests__/parseReadme.d.ts.map +1 -0
  150. package/lib/parse/__tests__/parseReadme.js +33 -0
  151. package/lib/parse/__tests__/parseSummary.d.ts +2 -0
  152. package/lib/parse/__tests__/parseSummary.d.ts.map +1 -0
  153. package/lib/parse/__tests__/parseSummary.js +30 -0
  154. package/lib/plugins/__tests__/listDependencies.d.ts +2 -0
  155. package/lib/plugins/__tests__/listDependencies.d.ts.map +1 -0
  156. package/lib/plugins/__tests__/listDependencies.js +28 -0
  157. package/lib/plugins/__tests__/sortDependencies.d.ts +2 -0
  158. package/lib/plugins/__tests__/sortDependencies.d.ts.map +1 -0
  159. package/lib/plugins/__tests__/sortDependencies.js +28 -0
  160. package/lib/plugins/__tests__/validatePlugin.d.ts +2 -0
  161. package/lib/plugins/__tests__/validatePlugin.d.ts.map +1 -0
  162. package/lib/plugins/__tests__/validatePlugin.js +99 -0
  163. package/lib/plugins/package-name-util.d.ts.map +1 -1
  164. package/lib/plugins/package-name-util.js +1 -2
  165. package/lib/templating/__tests__/conrefsLoader.d.ts +2 -0
  166. package/lib/templating/__tests__/conrefsLoader.d.ts.map +1 -0
  167. package/lib/templating/__tests__/conrefsLoader.js +90 -0
  168. package/lib/templating/__tests__/postRender.d.ts +2 -0
  169. package/lib/templating/__tests__/postRender.d.ts.map +1 -0
  170. package/lib/templating/__tests__/postRender.js +52 -0
  171. package/lib/templating/__tests__/replaceShortcuts.d.ts +2 -0
  172. package/lib/templating/__tests__/replaceShortcuts.d.ts.map +1 -0
  173. package/lib/templating/__tests__/replaceShortcuts.js +27 -0
  174. package/lib/utils/__tests__/git.d.ts +2 -0
  175. package/lib/utils/__tests__/git.d.ts.map +1 -0
  176. package/lib/utils/__tests__/git.js +46 -0
  177. package/lib/utils/__tests__/location.d.ts +2 -0
  178. package/lib/utils/__tests__/location.d.ts.map +1 -0
  179. package/lib/utils/__tests__/location.js +81 -0
  180. package/lib/utils/__tests__/path.d.ts +2 -0
  181. package/lib/utils/__tests__/path.d.ts.map +1 -0
  182. package/lib/utils/__tests__/path.js +19 -0
  183. package/package.json +19 -22
@@ -0,0 +1,7 @@
1
+ export let root: string;
2
+ export let title: string;
3
+ export let gitbook: string;
4
+ export namespace variables {
5
+ let version: string;
6
+ }
7
+ //# sourceMappingURL=book.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/__fixtures__/honkit/book.js"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ root: "./docs",
3
+ title: "HonKit Documentation",
4
+ // Enforce use of HonKit v3
5
+ gitbook: "3.1.1",
6
+ variables: {
7
+ version: "3.1.1",
8
+ },
9
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=e2e.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2e.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/e2e.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const bin_1 = require("../bin");
7
+ const path_1 = __importDefault(require("path"));
8
+ const jest_mock_process_1 = require("jest-mock-process");
9
+ const jest_serializer_strip_ansi_1 = require("@relmify/jest-serializer-strip-ansi");
10
+ const CWD = process.cwd();
11
+ const cwdPlugin = {
12
+ test: (value) => typeof value === "string" && value.includes(CWD),
13
+ print: (value, serialize) => {
14
+ if (typeof value === "string") {
15
+ return serialize(value.split(CWD).join("<CWD>").replace(/\\/g, "/"));
16
+ }
17
+ return value;
18
+ },
19
+ };
20
+ expect.addSnapshotSerializer(jest_serializer_strip_ansi_1.stripAnsi);
21
+ expect.addSnapshotSerializer(cwdPlugin);
22
+ describe("e2e", function () {
23
+ let stdoutMock;
24
+ beforeEach(() => {
25
+ stdoutMock = (0, jest_mock_process_1.mockProcessStdout)();
26
+ });
27
+ afterEach(() => {
28
+ stdoutMock.mockRestore();
29
+ });
30
+ it("`honkit parse` for multilang", async () => {
31
+ await (0, bin_1.run)([process.argv[0], "honkit", "parse", path_1.default.join(__dirname, "__fixtures__/multilang")]);
32
+ expect(stdoutMock.mock.calls).toMatchInlineSnapshot(`
33
+ [
34
+ [
35
+ "info: parsing multilingual book, with 2 languages
36
+ ",
37
+ ],
38
+ [
39
+ "warn: no summary file in this book
40
+ ",
41
+ ],
42
+ [
43
+ "warn: no summary file in this book
44
+ ",
45
+ ],
46
+ [
47
+ "info: Book located in: <CWD>/src/__tests__/__fixtures__/multilang
48
+ ",
49
+ ],
50
+ [
51
+ "info: 2 languages
52
+ ",
53
+ ],
54
+ [
55
+ "info: Language: English
56
+ ",
57
+ ],
58
+ [
59
+ "info: Introduction file is README.md
60
+ ",
61
+ ],
62
+ [
63
+ "info:
64
+ ",
65
+ ],
66
+ [
67
+ "info: Language: Japanese
68
+ ",
69
+ ],
70
+ [
71
+ "info: Introduction file is README.md
72
+ ",
73
+ ],
74
+ [
75
+ "info:
76
+ ",
77
+ ],
78
+ ]
79
+ `);
80
+ });
81
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/__tests__/init.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const tmp_1 = __importDefault(require("tmp"));
7
+ const init_1 = __importDefault(require("../init"));
8
+ describe("initBook", () => {
9
+ let dir;
10
+ beforeEach(() => {
11
+ dir = tmp_1.default.dirSync();
12
+ });
13
+ test("should create a README and SUMMARY for empty book", () => {
14
+ return (0, init_1.default)(dir.name).then(() => {
15
+ expect(dir.name).toHaveFile("README.md");
16
+ expect(dir.name).toHaveFile("SUMMARY.md");
17
+ });
18
+ });
19
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=satisfies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"satisfies.d.ts","sourceRoot":"","sources":["../../src/__tests__/satisfies.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const honkit_1 = __importDefault(require("../honkit"));
7
+ describe("satisfies", () => {
8
+ test("should return true for *", () => {
9
+ expect(honkit_1.default.satisfies("*")).toBe(true);
10
+ });
11
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=snapshot-asciidoc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-asciidoc.d.ts","sourceRoot":"","sources":["../../src/__tests__/snapshot-asciidoc.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const path_1 = __importDefault(require("path"));
30
+ const internal_test_utils_1 = require("@honkit/internal-test-utils");
31
+ const bin = __importStar(require("../bin"));
32
+ it("asciidoc snapshot", async () => {
33
+ const bookDir = path_1.default.join(__dirname, "__fixtures__/asciidoc");
34
+ const outputDir = path_1.default.join(__dirname, "__fixtures__/asciidoc/_book");
35
+ await bin.run([process.argv[0], ".", "build", bookDir, "--reload"]);
36
+ const maskContent = (content) => {
37
+ return content
38
+ .replace(/gitbook\.page\.hasChanged\(.*\);/g, ``)
39
+ .replace(/<meta name="generator" content="HonKit .*">/g, "");
40
+ };
41
+ for await (const item of (0, internal_test_utils_1.iterateDirectoryContents)({
42
+ baseDir: outputDir,
43
+ allowExtensions: [".html"],
44
+ maskContent
45
+ })) {
46
+ expect(item).toMatchSnapshot(item.filePath);
47
+ }
48
+ }, 60 * 1000);
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=snapshot-honkit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot-honkit.d.ts","sourceRoot":"","sources":["../../src/__tests__/snapshot-honkit.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const path_1 = __importDefault(require("path"));
30
+ const internal_test_utils_1 = require("@honkit/internal-test-utils");
31
+ const bin = __importStar(require("../bin"));
32
+ it("HonKit snapshots", async () => {
33
+ const bookDir = path_1.default.join(__dirname, "__fixtures__/honkit");
34
+ const outputDir = path_1.default.join(__dirname, "__fixtures__/honkit/_book");
35
+ await bin.run([process.argv[0], ".", "build", bookDir, "--reload"]);
36
+ const maskContent = (content) => {
37
+ return content
38
+ .replace(/gitbook\.page\.hasChanged\(.*\);/g, ``)
39
+ .replace(/<meta name="generator" content="HonKit .*">/g, "");
40
+ };
41
+ for await (const item of (0, internal_test_utils_1.iterateDirectoryContents)({
42
+ baseDir: outputDir,
43
+ allowExtensions: [".html"],
44
+ maskContent
45
+ })) {
46
+ expect(item).toMatchSnapshot(item.filePath);
47
+ }
48
+ }, 60 * 1000);
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/cli/server.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAO5B,cAAM,MAAO,SAAQ,MAAM,CAAC,YAAY;IACpC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,GAAG,CAAO;IAClB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,OAAO,CAAQ;;IASvB;;;;OAIG;IACH,SAAS;IAIT;;;;OAIG;IACH,IAAI;IAqBJ;;;;OAIG;IACH,KAAK,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA;CA0DlB;AAcD,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/cli/server.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAM5B,cAAM,MAAO,SAAQ,MAAM,CAAC,YAAY;IACpC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,GAAG,CAAO;IAClB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,OAAO,CAAQ;;IASvB;;;;OAIG;IACH,SAAS;IAIT;;;;OAIG;IACH,IAAI;IAqBJ;;;;OAIG;IACH,KAAK,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA;CA0DlB;AAcD,eAAe,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=configSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configSchema.d.ts","sourceRoot":"","sources":["../../../src/constants/__tests__/configSchema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsonschema_1 = __importDefault(require("jsonschema"));
7
+ const configSchema_1 = __importDefault(require("../configSchema"));
8
+ describe("configSchema", () => {
9
+ function validate(cfg) {
10
+ const v = new jsonschema_1.default.Validator();
11
+ return v.validate(cfg, configSchema_1.default, {
12
+ propertyName: "config",
13
+ });
14
+ }
15
+ describe("structure", () => {
16
+ test("should accept dot in filename", () => {
17
+ const result = validate({
18
+ structure: {
19
+ readme: "book-intro.adoc",
20
+ },
21
+ });
22
+ expect(result.errors.length).toBe(0);
23
+ });
24
+ test("should accept uppercase in filename", () => {
25
+ const result = validate({
26
+ structure: {
27
+ readme: "BOOK.adoc",
28
+ },
29
+ });
30
+ expect(result.errors.length).toBe(0);
31
+ });
32
+ test("should not accept filepath", () => {
33
+ const result = validate({
34
+ structure: {
35
+ readme: "folder/myFile.md",
36
+ },
37
+ });
38
+ expect(result.errors.length).toBe(1);
39
+ });
40
+ });
41
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/fs/__tests__/mock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const mock_1 = __importDefault(require("../mock"));
7
+ describe("MockFS", () => {
8
+ const fs = (0, mock_1.default)({
9
+ "README.md": "Hello World",
10
+ "SUMMARY.md": "# Summary",
11
+ folder: {
12
+ "test.md": "Cool",
13
+ folder2: {
14
+ "hello.md": "Hello",
15
+ "world.md": "World"
16
+ }
17
+ }
18
+ });
19
+ describe("exists", () => {
20
+ test("must return true for a file", () => {
21
+ return fs.exists("README.md").then((result) => {
22
+ expect(result).toBeTruthy();
23
+ });
24
+ });
25
+ test("must return false for a non existing file", () => {
26
+ return fs.exists("README_NOTEXISTS.md").then((result) => {
27
+ expect(result).toBeFalsy();
28
+ });
29
+ });
30
+ test("must return true for a directory", () => {
31
+ return fs.exists("folder").then((result) => {
32
+ expect(result).toBeTruthy();
33
+ });
34
+ });
35
+ test("must return true for a deep file", () => {
36
+ return fs.exists("folder/test.md").then((result) => {
37
+ expect(result).toBeTruthy();
38
+ });
39
+ });
40
+ test("must return true for a deep file (2)", () => {
41
+ return fs.exists("folder/folder2/hello.md").then((result) => {
42
+ expect(result).toBeTruthy();
43
+ });
44
+ });
45
+ });
46
+ describe("readAsString", () => {
47
+ test("must return content for a file", () => {
48
+ return fs.readAsString("README.md").then((result) => {
49
+ expect(result).toBe("Hello World");
50
+ });
51
+ });
52
+ test("must return content for a deep file", () => {
53
+ return fs.readAsString("folder/test.md").then((result) => {
54
+ expect(result).toBe("Cool");
55
+ });
56
+ });
57
+ });
58
+ describe("readDir", () => {
59
+ test("must return content for a directory", () => {
60
+ return fs.readDir("./").then((files) => {
61
+ expect(files.size).toBe(3);
62
+ expect(files.includes("README.md")).toBeTruthy();
63
+ expect(files.includes("SUMMARY.md")).toBeTruthy();
64
+ expect(files.includes("folder/")).toBeTruthy();
65
+ });
66
+ });
67
+ });
68
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const immutable_1 = __importDefault(require("immutable"));
7
+ const config_1 = __importDefault(require("../config"));
8
+ describe("Config", () => {
9
+ const config = config_1.default.createWithValues({
10
+ hello: {
11
+ world: 1,
12
+ test: "Hello",
13
+ isFalse: false,
14
+ },
15
+ });
16
+ describe("getValue", () => {
17
+ test("must return value as immutable", () => {
18
+ const value = config.getValue("hello");
19
+ expect(immutable_1.default.Map.isMap(value)).toBeTruthy();
20
+ });
21
+ test("must return deep value", () => {
22
+ const value = config.getValue("hello.world");
23
+ expect(value).toBe(1);
24
+ });
25
+ test("must return default value if non existant", () => {
26
+ const value = config.getValue("hello.nonExistant", "defaultValue");
27
+ expect(value).toBe("defaultValue");
28
+ });
29
+ test("must not return default value for falsy values", () => {
30
+ const value = config.getValue("hello.isFalse", "defaultValue");
31
+ expect(value).toBe(false);
32
+ });
33
+ });
34
+ describe("setValue", () => {
35
+ test("must set value as immutable", () => {
36
+ const testConfig = config.setValue("hello", {
37
+ cool: 1,
38
+ });
39
+ const value = testConfig.getValue("hello");
40
+ expect(immutable_1.default.Map.isMap(value)).toBeTruthy();
41
+ expect(value.size).toBe(1);
42
+ expect(value.has("cool")).toBeTruthy();
43
+ });
44
+ test("must set deep value", () => {
45
+ const testConfig = config.setValue("hello.world", 2);
46
+ const hello = testConfig.getValue("hello");
47
+ const world = testConfig.getValue("hello.world");
48
+ expect(immutable_1.default.Map.isMap(hello)).toBeTruthy();
49
+ expect(hello.size).toBe(3);
50
+ expect(world).toBe(2);
51
+ });
52
+ });
53
+ describe("toReducedVersion", () => {
54
+ test("must only return diffs for simple values", () => {
55
+ const _config = config_1.default.createWithValues({
56
+ gitbook: "3.0.0",
57
+ });
58
+ const reducedVersion = _config.toReducedVersion();
59
+ expect(reducedVersion.toJS()).toEqual({
60
+ gitbook: "3.0.0",
61
+ });
62
+ });
63
+ test("must only return diffs for deep values", () => {
64
+ const _config = config_1.default.createWithValues({
65
+ structure: {
66
+ readme: "intro.md",
67
+ },
68
+ });
69
+ const reducedVersion = _config.toReducedVersion();
70
+ expect(reducedVersion.toJS()).toEqual({
71
+ structure: {
72
+ readme: "intro.md",
73
+ },
74
+ });
75
+ });
76
+ });
77
+ describe("getPluginDependencies", () => {
78
+ const config = config_1.default.createWithValues({
79
+ plugins: [
80
+ "example",
81
+ "honkit-plugin-example",
82
+ "@example/example",
83
+ "@example/honkit-plugin-example",
84
+ "@honkit/honkit-plugin-example",
85
+ "-no-use",
86
+ "-honkit-plugin-no-use",
87
+ "-@honkit/honkit-plugin-no-use",
88
+ // GitBook logic - deprecated
89
+ "example-v@1.0.0",
90
+ "gitbook-plugin-example-v@1.0.0",
91
+ "example@git+ssh://samy@github.com/GitbookIO/plugin-ga.git",
92
+ ],
93
+ });
94
+ const dependencies = config.getPluginDependencies();
95
+ expect(dependencies.toJS()).toEqual([
96
+ {
97
+ enabled: true,
98
+ name: "example",
99
+ path: "",
100
+ version: "*",
101
+ },
102
+ {
103
+ enabled: true,
104
+ name: "honkit-plugin-example",
105
+ path: "",
106
+ version: "*",
107
+ },
108
+ {
109
+ enabled: true,
110
+ name: "@example/example",
111
+ path: "",
112
+ version: "*",
113
+ },
114
+ {
115
+ enabled: true,
116
+ name: "@example/honkit-plugin-example",
117
+ path: "",
118
+ version: "*",
119
+ },
120
+ {
121
+ enabled: true,
122
+ name: "@honkit/honkit-plugin-example",
123
+ path: "",
124
+ version: "*",
125
+ },
126
+ {
127
+ enabled: false,
128
+ name: "no-use",
129
+ path: "",
130
+ version: "*",
131
+ },
132
+ {
133
+ enabled: false,
134
+ name: "honkit-plugin-no-use",
135
+ path: "",
136
+ version: "*",
137
+ },
138
+ {
139
+ enabled: false,
140
+ name: "@honkit/honkit-plugin-no-use",
141
+ path: "",
142
+ version: "*",
143
+ },
144
+ {
145
+ enabled: true,
146
+ name: "example-v",
147
+ path: "",
148
+ version: "1.0.0",
149
+ },
150
+ {
151
+ enabled: true,
152
+ name: "gitbook-plugin-example-v",
153
+ path: "",
154
+ version: "1.0.0",
155
+ },
156
+ {
157
+ enabled: true,
158
+ name: "example",
159
+ path: "",
160
+ version: "git+ssh://samy@github.com/GitbookIO/plugin-ga.git",
161
+ },
162
+ ]);
163
+ });
164
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=glossary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glossary.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/glossary.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const file_1 = __importDefault(require("../file"));
7
+ const glossary_1 = __importDefault(require("../glossary"));
8
+ const glossaryEntry_1 = __importDefault(require("../glossaryEntry"));
9
+ describe("Glossary", () => {
10
+ const glossary = glossary_1.default.createFromEntries(new file_1.default(), [
11
+ {
12
+ name: "Hello World",
13
+ description: "Awesome!",
14
+ },
15
+ {
16
+ name: "JavaScript",
17
+ description: "This is a cool language",
18
+ },
19
+ ]);
20
+ describe("createFromEntries", () => {
21
+ test("must add all entries", () => {
22
+ const entries = glossary.getEntries();
23
+ expect(entries.size).toBe(2);
24
+ });
25
+ test("must add entries as GlossaryEntries", () => {
26
+ const entries = glossary.getEntries();
27
+ const entry = entries.get("hello-world");
28
+ expect(entry instanceof glossaryEntry_1.default).toBeTruthy();
29
+ });
30
+ });
31
+ describe("toText", () => {
32
+ test("return as markdown", () => {
33
+ return glossary.toText(".md").then((text) => {
34
+ expect(text).toContain("# Glossary");
35
+ });
36
+ });
37
+ });
38
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=glossaryEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glossaryEntry.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/glossaryEntry.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const glossaryEntry_1 = __importDefault(require("../glossaryEntry"));
7
+ describe("GlossaryEntry", () => {
8
+ describe("getID", () => {
9
+ test("must return a normalized ID", () => {
10
+ const entry = new glossaryEntry_1.default({
11
+ name: "Hello World",
12
+ });
13
+ expect(entry.getID()).toBe("hello-world");
14
+ });
15
+ });
16
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/page.ts"],"names":[],"mappings":""}