honkit 5.1.4 → 6.0.0
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/lib/api/decodeConfig.js +1 -2
- package/lib/api/decodeGlobal.js +1 -2
- package/lib/api/encodeGlobal.d.ts.map +1 -1
- package/lib/bin.d.ts.map +1 -1
- package/lib/cli/buildEbook.js +1 -1
- package/lib/cli/server.d.ts +0 -1
- package/lib/cli/server.d.ts.map +1 -1
- package/lib/cli/server.js +4 -0
- package/lib/fs/node.js +1 -1
- package/lib/models/file.d.ts +0 -1
- package/lib/models/file.d.ts.map +1 -1
- package/lib/models/fs.d.ts +0 -1
- package/lib/models/fs.d.ts.map +1 -1
- package/lib/models/hash.js +2 -2
- package/lib/output/generateBook.js +2 -3
- package/lib/output/json/onFinish.js +1 -2
- package/lib/output/json/onPage.js +1 -2
- package/lib/output/modifiers/fetchRemoteImages.d.ts +2 -2
- package/lib/output/modifiers/fetchRemoteImages.d.ts.map +1 -1
- package/lib/output/modifiers/inlineSvg.d.ts.map +1 -1
- package/lib/output/modifiers/inlineSvg.js +1 -0
- package/lib/output/modifiers/modifyHTML.d.ts.map +1 -1
- package/lib/output/modifiers/modifyHTML.js +1 -0
- package/lib/output/testing/generateMock.js +1 -2
- package/lib/output/website/onFinish.js +1 -2
- package/lib/output/website/onPage.js +1 -2
- package/lib/plugins/PluginResolver.js +2 -1
- package/lib/plugins/loadPlugin.js +1 -2
- package/lib/utils/command.d.ts +0 -1
- package/lib/utils/command.d.ts.map +1 -1
- package/lib/utils/fs.d.ts +0 -1
- package/lib/utils/fs.d.ts.map +1 -1
- package/lib/utils/promise.js +6 -7
- package/package.json +33 -31
- package/lib/__tests__/__fixtures__/honkit/book.d.ts +0 -7
- package/lib/__tests__/__fixtures__/honkit/book.d.ts.map +0 -1
- package/lib/__tests__/__fixtures__/honkit/book.js +0 -9
- package/lib/__tests__/e2e.test.d.ts +0 -2
- package/lib/__tests__/e2e.test.d.ts.map +0 -1
- package/lib/__tests__/e2e.test.js +0 -81
- package/lib/__tests__/init.d.ts +0 -2
- package/lib/__tests__/init.d.ts.map +0 -1
- package/lib/__tests__/init.js +0 -19
- package/lib/__tests__/satisfies.d.ts +0 -2
- package/lib/__tests__/satisfies.d.ts.map +0 -1
- package/lib/__tests__/satisfies.js +0 -11
- package/lib/__tests__/snapshot-asciidoc.d.ts +0 -2
- package/lib/__tests__/snapshot-asciidoc.d.ts.map +0 -1
- package/lib/__tests__/snapshot-asciidoc.js +0 -48
- package/lib/__tests__/snapshot-honkit.d.ts +0 -2
- package/lib/__tests__/snapshot-honkit.d.ts.map +0 -1
- package/lib/__tests__/snapshot-honkit.js +0 -48
- package/lib/constants/__tests__/configSchema.d.ts +0 -2
- package/lib/constants/__tests__/configSchema.d.ts.map +0 -1
- package/lib/constants/__tests__/configSchema.js +0 -41
- package/lib/fs/__tests__/mock.d.ts +0 -2
- package/lib/fs/__tests__/mock.d.ts.map +0 -1
- package/lib/fs/__tests__/mock.js +0 -68
- package/lib/models/__tests__/config.d.ts +0 -2
- package/lib/models/__tests__/config.d.ts.map +0 -1
- package/lib/models/__tests__/config.js +0 -164
- package/lib/models/__tests__/glossary.d.ts +0 -2
- package/lib/models/__tests__/glossary.d.ts.map +0 -1
- package/lib/models/__tests__/glossary.js +0 -38
- package/lib/models/__tests__/glossaryEntry.d.ts +0 -2
- package/lib/models/__tests__/glossaryEntry.d.ts.map +0 -1
- package/lib/models/__tests__/glossaryEntry.js +0 -16
- package/lib/models/__tests__/page.d.ts +0 -2
- package/lib/models/__tests__/page.d.ts.map +0 -1
- package/lib/models/__tests__/page.js +0 -26
- package/lib/models/__tests__/plugin.d.ts +0 -2
- package/lib/models/__tests__/plugin.d.ts.map +0 -1
- package/lib/models/__tests__/plugin.js +0 -50
- package/lib/models/__tests__/pluginDependency.d.ts +0 -2
- package/lib/models/__tests__/pluginDependency.d.ts.map +0 -1
- package/lib/models/__tests__/pluginDependency.js +0 -71
- package/lib/models/__tests__/summary.d.ts +0 -2
- package/lib/models/__tests__/summary.d.ts.map +0 -1
- package/lib/models/__tests__/summary.js +0 -115
- package/lib/models/__tests__/summaryArticle.d.ts +0 -2
- package/lib/models/__tests__/summaryArticle.d.ts.map +0 -1
- package/lib/models/__tests__/summaryArticle.js +0 -117
- package/lib/models/__tests__/summaryPart.d.ts +0 -2
- package/lib/models/__tests__/summaryPart.d.ts.map +0 -1
- package/lib/models/__tests__/summaryPart.js +0 -24
- package/lib/models/__tests__/templateBlock.d.ts +0 -2
- package/lib/models/__tests__/templateBlock.d.ts.map +0 -1
- package/lib/models/__tests__/templateBlock.js +0 -172
- package/lib/models/__tests__/templateEngine.d.ts +0 -2
- package/lib/models/__tests__/templateEngine.d.ts.map +0 -1
- package/lib/models/__tests__/templateEngine.js +0 -49
- package/lib/modifiers/config/__tests__/addPlugin.d.ts +0 -2
- package/lib/modifiers/config/__tests__/addPlugin.d.ts.map +0 -1
- package/lib/modifiers/config/__tests__/addPlugin.js +0 -30
- package/lib/modifiers/config/__tests__/removePlugin.d.ts +0 -2
- package/lib/modifiers/config/__tests__/removePlugin.d.ts.map +0 -1
- package/lib/modifiers/config/__tests__/removePlugin.js +0 -29
- package/lib/modifiers/config/__tests__/togglePlugin.d.ts +0 -2
- package/lib/modifiers/config/__tests__/togglePlugin.d.ts.map +0 -1
- package/lib/modifiers/config/__tests__/togglePlugin.js +0 -28
- package/lib/modifiers/summary/__tests__/editPartTitle.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/editPartTitle.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/editPartTitle.js +0 -41
- package/lib/modifiers/summary/__tests__/insertArticle.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/insertArticle.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/insertArticle.js +0 -72
- package/lib/modifiers/summary/__tests__/insertPart.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/insertPart.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/insertPart.js +0 -56
- package/lib/modifiers/summary/__tests__/mergeAtLevel.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/mergeAtLevel.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/mergeAtLevel.js +0 -45
- package/lib/modifiers/summary/__tests__/moveArticle.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/moveArticle.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/moveArticle.js +0 -66
- package/lib/modifiers/summary/__tests__/moveArticleAfter.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/moveArticleAfter.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/moveArticleAfter.js +0 -75
- package/lib/modifiers/summary/__tests__/removeArticle.d.ts +0 -2
- package/lib/modifiers/summary/__tests__/removeArticle.d.ts.map +0 -1
- package/lib/modifiers/summary/__tests__/removeArticle.js +0 -54
- package/lib/output/__tests__/ebook.d.ts +0 -2
- package/lib/output/__tests__/ebook.d.ts.map +0 -1
- package/lib/output/__tests__/ebook.js +0 -17
- package/lib/output/__tests__/json.d.ts +0 -2
- package/lib/output/__tests__/json.d.ts.map +0 -1
- package/lib/output/__tests__/json.js +0 -43
- package/lib/output/__tests__/plugin-hooks.d.ts +0 -2
- package/lib/output/__tests__/plugin-hooks.d.ts.map +0 -1
- package/lib/output/__tests__/plugin-hooks.js +0 -57
- package/lib/output/__tests__/website.d.ts +0 -2
- package/lib/output/__tests__/website.d.ts.map +0 -1
- package/lib/output/__tests__/website.js +0 -121
- package/lib/output/modifiers/__tests__/addHeadingId.d.ts +0 -2
- package/lib/output/modifiers/__tests__/addHeadingId.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/addHeadingId.js +0 -46
- package/lib/output/modifiers/__tests__/annotateText.d.ts +0 -2
- package/lib/output/modifiers/__tests__/annotateText.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/annotateText.js +0 -76
- package/lib/output/modifiers/__tests__/fetchRemoteImages.d.ts +0 -2
- package/lib/output/modifiers/__tests__/fetchRemoteImages.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/fetchRemoteImages.js +0 -69
- package/lib/output/modifiers/__tests__/highlightCode.d.ts +0 -2
- package/lib/output/modifiers/__tests__/highlightCode.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/highlightCode.js +0 -71
- package/lib/output/modifiers/__tests__/inlinePng.d.ts +0 -2
- package/lib/output/modifiers/__tests__/inlinePng.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/inlinePng.js +0 -45
- package/lib/output/modifiers/__tests__/inlineSvg.d.ts +0 -2
- package/lib/output/modifiers/__tests__/inlineSvg.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/inlineSvg.js +0 -65
- package/lib/output/modifiers/__tests__/resolveImages.d.ts +0 -2
- package/lib/output/modifiers/__tests__/resolveImages.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/resolveImages.js +0 -62
- package/lib/output/modifiers/__tests__/resolveLinks.d.ts +0 -2
- package/lib/output/modifiers/__tests__/resolveLinks.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/resolveLinks.js +0 -104
- package/lib/output/modifiers/__tests__/svgToImg.d.ts +0 -2
- package/lib/output/modifiers/__tests__/svgToImg.d.ts.map +0 -1
- package/lib/output/modifiers/__tests__/svgToImg.js +0 -52
- package/lib/output/website/__tests__/i18n.d.ts +0 -2
- package/lib/output/website/__tests__/i18n.d.ts.map +0 -1
- package/lib/output/website/__tests__/i18n.js +0 -40
- package/lib/parse/__tests__/listAssets.d.ts +0 -2
- package/lib/parse/__tests__/listAssets.d.ts.map +0 -1
- package/lib/parse/__tests__/listAssets.js +0 -63
- package/lib/parse/__tests__/parseBook.d.ts +0 -2
- package/lib/parse/__tests__/parseBook.d.ts.map +0 -1
- package/lib/parse/__tests__/parseBook.js +0 -77
- package/lib/parse/__tests__/parseGlossary.d.ts +0 -2
- package/lib/parse/__tests__/parseGlossary.d.ts.map +0 -1
- package/lib/parse/__tests__/parseGlossary.js +0 -32
- package/lib/parse/__tests__/parseIgnore.d.ts +0 -2
- package/lib/parse/__tests__/parseIgnore.d.ts.map +0 -1
- package/lib/parse/__tests__/parseIgnore.js +0 -37
- package/lib/parse/__tests__/parsePageFromString.d.ts +0 -2
- package/lib/parse/__tests__/parsePageFromString.d.ts.map +0 -1
- package/lib/parse/__tests__/parsePageFromString.js +0 -34
- package/lib/parse/__tests__/parseReadme.d.ts +0 -2
- package/lib/parse/__tests__/parseReadme.d.ts.map +0 -1
- package/lib/parse/__tests__/parseReadme.js +0 -33
- package/lib/parse/__tests__/parseSummary.d.ts +0 -2
- package/lib/parse/__tests__/parseSummary.d.ts.map +0 -1
- package/lib/parse/__tests__/parseSummary.js +0 -30
- package/lib/plugins/__tests__/listDependencies.d.ts +0 -2
- package/lib/plugins/__tests__/listDependencies.d.ts.map +0 -1
- package/lib/plugins/__tests__/listDependencies.js +0 -28
- package/lib/plugins/__tests__/sortDependencies.d.ts +0 -2
- package/lib/plugins/__tests__/sortDependencies.d.ts.map +0 -1
- package/lib/plugins/__tests__/sortDependencies.js +0 -28
- package/lib/plugins/__tests__/validatePlugin.d.ts +0 -2
- package/lib/plugins/__tests__/validatePlugin.d.ts.map +0 -1
- package/lib/plugins/__tests__/validatePlugin.js +0 -99
- package/lib/templating/__tests__/conrefsLoader.d.ts +0 -2
- package/lib/templating/__tests__/conrefsLoader.d.ts.map +0 -1
- package/lib/templating/__tests__/conrefsLoader.js +0 -90
- package/lib/templating/__tests__/postRender.d.ts +0 -2
- package/lib/templating/__tests__/postRender.d.ts.map +0 -1
- package/lib/templating/__tests__/postRender.js +0 -52
- package/lib/templating/__tests__/replaceShortcuts.d.ts +0 -2
- package/lib/templating/__tests__/replaceShortcuts.d.ts.map +0 -1
- package/lib/templating/__tests__/replaceShortcuts.js +0 -27
- package/lib/utils/__tests__/git.d.ts +0 -2
- package/lib/utils/__tests__/git.d.ts.map +0 -1
- package/lib/utils/__tests__/git.js +0 -46
- package/lib/utils/__tests__/location.d.ts +0 -2
- package/lib/utils/__tests__/location.d.ts.map +0 -1
- package/lib/utils/__tests__/location.js +0 -81
- package/lib/utils/__tests__/path.d.ts +0 -2
- package/lib/utils/__tests__/path.d.ts.map +0 -1
- package/lib/utils/__tests__/path.js +0 -19
package/lib/__tests__/init.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"satisfies.d.ts","sourceRoot":"","sources":["../../src/__tests__/satisfies.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot-asciidoc.d.ts","sourceRoot":"","sources":["../../src/__tests__/snapshot-asciidoc.ts"],"names":[],"mappings":""}
|
|
@@ -1,48 +0,0 @@
|
|
|
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);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot-honkit.d.ts","sourceRoot":"","sources":["../../src/__tests__/snapshot-honkit.ts"],"names":[],"mappings":""}
|
|
@@ -1,48 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configSchema.d.ts","sourceRoot":"","sources":["../../../src/constants/__tests__/configSchema.ts"],"names":[],"mappings":""}
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/fs/__tests__/mock.ts"],"names":[],"mappings":""}
|
package/lib/fs/__tests__/mock.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/config.ts"],"names":[],"mappings":""}
|
|
@@ -1,164 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glossary.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/glossary.ts"],"names":[],"mappings":""}
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glossaryEntry.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/glossaryEntry.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/page.ts"],"names":[],"mappings":""}
|
|
@@ -1,26 +0,0 @@
|
|
|
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 page_1 = __importDefault(require("../page"));
|
|
8
|
-
describe("Page", () => {
|
|
9
|
-
describe("toText", () => {
|
|
10
|
-
test("must not prepend frontmatter if no attributes", () => {
|
|
11
|
-
const page = new page_1.default().merge({
|
|
12
|
-
content: "Hello World",
|
|
13
|
-
});
|
|
14
|
-
expect(page.toText()).toBe("Hello World");
|
|
15
|
-
});
|
|
16
|
-
test("must prepend frontmatter if attributes", () => {
|
|
17
|
-
const page = new page_1.default().merge({
|
|
18
|
-
content: "Hello World",
|
|
19
|
-
attributes: immutable_1.default.fromJS({
|
|
20
|
-
hello: "world",
|
|
21
|
-
}),
|
|
22
|
-
});
|
|
23
|
-
expect(page.toText()).toBe("---\nhello: world\n---\n\nHello World");
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/plugin.ts"],"names":[],"mappings":""}
|
|
@@ -1,50 +0,0 @@
|
|
|
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 plugin_1 = __importDefault(require("../plugin"));
|
|
7
|
-
const immutable_1 = __importDefault(require("immutable"));
|
|
8
|
-
describe("Plugin", () => {
|
|
9
|
-
describe("createFromString", () => {
|
|
10
|
-
test("must parse name", () => {
|
|
11
|
-
const plugin = plugin_1.default.createFromString("hello");
|
|
12
|
-
expect(plugin.getName()).toBe("hello");
|
|
13
|
-
expect(plugin.getVersion()).toBe("*");
|
|
14
|
-
});
|
|
15
|
-
test("must parse version", () => {
|
|
16
|
-
const plugin = plugin_1.default.createFromString("hello@1.0.0");
|
|
17
|
-
expect(plugin.getName()).toBe("hello");
|
|
18
|
-
expect(plugin.getVersion()).toBe("1.0.0");
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
describe("getNpmId", () => {
|
|
22
|
-
it("should return package's name", () => {
|
|
23
|
-
const plugin = new plugin_1.default({
|
|
24
|
-
name: "testplugin",
|
|
25
|
-
version: "*",
|
|
26
|
-
path: "test.js",
|
|
27
|
-
package: immutable_1.default.fromJS({
|
|
28
|
-
name: "testplugin-name"
|
|
29
|
-
}),
|
|
30
|
-
content: immutable_1.default.fromJS({
|
|
31
|
-
hooks: {
|
|
32
|
-
"page:before": function (page) {
|
|
33
|
-
return page;
|
|
34
|
-
},
|
|
35
|
-
page: function (page) {
|
|
36
|
-
return page;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
});
|
|
41
|
-
expect(plugin.getNpmID()).toBe("testplugin-name");
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
describe("isLoaded", () => {
|
|
45
|
-
test("must return false for empty plugin", () => {
|
|
46
|
-
const plugin = plugin_1.default.createFromString("hello");
|
|
47
|
-
expect(plugin.isLoaded()).toBe(false);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pluginDependency.d.ts","sourceRoot":"","sources":["../../../src/models/__tests__/pluginDependency.ts"],"names":[],"mappings":""}
|