honkit 5.1.5 → 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
|
@@ -1,30 +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 book_1 = __importDefault(require("../../models/book"));
|
|
7
|
-
const mock_1 = __importDefault(require("../../fs/mock"));
|
|
8
|
-
const parseSummary_1 = __importDefault(require("../parseSummary"));
|
|
9
|
-
describe("parseSummary", () => {
|
|
10
|
-
test("should parse summary if exists", () => {
|
|
11
|
-
const fs = (0, mock_1.default)({
|
|
12
|
-
"SUMMARY.md": "# Summary\n\n* [Hello](hello.md)",
|
|
13
|
-
});
|
|
14
|
-
const book = book_1.default.createForFS(fs);
|
|
15
|
-
return (0, parseSummary_1.default)(book).then((resultBook) => {
|
|
16
|
-
const summary = resultBook.getSummary();
|
|
17
|
-
const file = summary.getFile();
|
|
18
|
-
expect(file.exists()).toBeTruthy();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
test("should not fail if doesn't exist", () => {
|
|
22
|
-
const fs = (0, mock_1.default)({});
|
|
23
|
-
const book = book_1.default.createForFS(fs);
|
|
24
|
-
return (0, parseSummary_1.default)(book).then((resultBook) => {
|
|
25
|
-
const summary = resultBook.getSummary();
|
|
26
|
-
const file = summary.getFile();
|
|
27
|
-
expect(file.exists()).toBeFalsy();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listDependencies.d.ts","sourceRoot":"","sources":["../../../src/plugins/__tests__/listDependencies.ts"],"names":[],"mappings":""}
|
|
@@ -1,28 +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 pluginDependency_1 = __importDefault(require("../../models/pluginDependency"));
|
|
7
|
-
const listDependencies_1 = __importDefault(require("../listDependencies"));
|
|
8
|
-
const toNames_1 = __importDefault(require("../toNames"));
|
|
9
|
-
describe("listDependencies", () => {
|
|
10
|
-
test("must list default", () => {
|
|
11
|
-
const deps = pluginDependency_1.default.listFromString("ga,great");
|
|
12
|
-
const plugins = (0, listDependencies_1.default)(deps);
|
|
13
|
-
const names = (0, toNames_1.default)(plugins);
|
|
14
|
-
expect(names).toEqual(["ga", "great", "highlight", "search", "lunr", "fontsettings", "theme-default"]);
|
|
15
|
-
});
|
|
16
|
-
test("must list from array with -", () => {
|
|
17
|
-
const deps = pluginDependency_1.default.listFromString("ga,-great");
|
|
18
|
-
const plugins = (0, listDependencies_1.default)(deps);
|
|
19
|
-
const names = (0, toNames_1.default)(plugins);
|
|
20
|
-
expect(names).toEqual(["ga", "highlight", "search", "lunr", "fontsettings", "theme-default"]);
|
|
21
|
-
});
|
|
22
|
-
test("must remove default plugins using -", () => {
|
|
23
|
-
const deps = pluginDependency_1.default.listFromString("ga,-search");
|
|
24
|
-
const plugins = (0, listDependencies_1.default)(deps);
|
|
25
|
-
const names = (0, toNames_1.default)(plugins);
|
|
26
|
-
expect(names).toEqual(["ga", "highlight", "lunr", "fontsettings", "theme-default"]);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sortDependencies.d.ts","sourceRoot":"","sources":["../../../src/plugins/__tests__/sortDependencies.ts"],"names":[],"mappings":""}
|
|
@@ -1,28 +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 pluginDependency_1 = __importDefault(require("../../models/pluginDependency"));
|
|
7
|
-
const sortDependencies_1 = __importDefault(require("../sortDependencies"));
|
|
8
|
-
const toNames_1 = __importDefault(require("../toNames"));
|
|
9
|
-
describe("sortDependencies", () => {
|
|
10
|
-
test("must load themes after plugins", () => {
|
|
11
|
-
const allPlugins = pluginDependency_1.default.listFromArray(["hello", "theme-test", "world"]);
|
|
12
|
-
const sorted = (0, sortDependencies_1.default)(allPlugins);
|
|
13
|
-
const names = (0, toNames_1.default)(sorted);
|
|
14
|
-
expect(names).toEqual(["hello", "world", "theme-test"]);
|
|
15
|
-
});
|
|
16
|
-
test("must keep order of themes", () => {
|
|
17
|
-
const allPlugins = pluginDependency_1.default.listFromArray([
|
|
18
|
-
"theme-test",
|
|
19
|
-
"theme-test1",
|
|
20
|
-
"hello",
|
|
21
|
-
"theme-test2",
|
|
22
|
-
"world",
|
|
23
|
-
]);
|
|
24
|
-
const sorted = (0, sortDependencies_1.default)(allPlugins);
|
|
25
|
-
const names = (0, toNames_1.default)(sorted);
|
|
26
|
-
expect(names).toEqual(["hello", "world", "theme-test", "theme-test1", "theme-test2"]);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validatePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/__tests__/validatePlugin.ts"],"names":[],"mappings":""}
|
|
@@ -1,99 +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 promise_1 = __importDefault(require("../../utils/promise"));
|
|
8
|
-
const plugin_1 = __importDefault(require("../../models/plugin"));
|
|
9
|
-
const validatePlugin_1 = __importDefault(require("../validatePlugin"));
|
|
10
|
-
describe("validatePlugin", () => {
|
|
11
|
-
test("must not validate a not loaded plugin", () => {
|
|
12
|
-
const plugin = plugin_1.default.createFromString("test");
|
|
13
|
-
return (0, validatePlugin_1.default)(plugin).then(() => {
|
|
14
|
-
throw new Error("Should not be validate");
|
|
15
|
-
}, (err) => {
|
|
16
|
-
return (0, promise_1.default)();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
test("alpha plugin can loaded plugin", () => {
|
|
20
|
-
const testPkgRequireAlphaVersion = {
|
|
21
|
-
title: "Disqus",
|
|
22
|
-
name: "gitbook-plugin-disqus",
|
|
23
|
-
description: "Disqus comments thread in the footer of your pages",
|
|
24
|
-
icon: "./icon.png",
|
|
25
|
-
main: "index.js",
|
|
26
|
-
browser: "./_assets/plugin.js",
|
|
27
|
-
version: "1.0.1",
|
|
28
|
-
engines: {
|
|
29
|
-
gitbook: ">=4.0.0-alpha",
|
|
30
|
-
},
|
|
31
|
-
dependencies: {
|
|
32
|
-
react: "^15.3.2",
|
|
33
|
-
"react-disqus-thread": "^0.4.0",
|
|
34
|
-
},
|
|
35
|
-
devDependencies: {
|
|
36
|
-
"gitbook-plugin": "^4.0.0-alpha.0",
|
|
37
|
-
eslint: "3.7.1",
|
|
38
|
-
"eslint-config-gitbook": "1.4.0",
|
|
39
|
-
},
|
|
40
|
-
homepage: "https://github.com/GitbookIO/plugin-disqus",
|
|
41
|
-
repository: {
|
|
42
|
-
type: "git",
|
|
43
|
-
url: "https://github.com/GitbookIO/plugin-disqus.git",
|
|
44
|
-
},
|
|
45
|
-
license: "Apache-2.0",
|
|
46
|
-
bugs: {
|
|
47
|
-
url: "https://github.com/GitbookIO/plugin-disqus/issues",
|
|
48
|
-
},
|
|
49
|
-
keywords: ["gitbook:social"],
|
|
50
|
-
scripts: {
|
|
51
|
-
"build-js": "gitbook-plugin build ./src/index.js ./_assets/plugin.js",
|
|
52
|
-
prepublish: "npm run build-js",
|
|
53
|
-
},
|
|
54
|
-
gitbook: {
|
|
55
|
-
properties: {
|
|
56
|
-
shortName: {
|
|
57
|
-
type: "string",
|
|
58
|
-
title: "Website Shortname",
|
|
59
|
-
description: "Unique identifier for your website as registered on Disqus",
|
|
60
|
-
required: true,
|
|
61
|
-
},
|
|
62
|
-
useIdentifier: {
|
|
63
|
-
type: "boolean",
|
|
64
|
-
title: "Pass page identifier option to Disqus",
|
|
65
|
-
default: false,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
page: {
|
|
69
|
-
title: "Disqus configuration for this page",
|
|
70
|
-
properties: {
|
|
71
|
-
disqus: {
|
|
72
|
-
type: "object",
|
|
73
|
-
properties: {
|
|
74
|
-
enabled: {
|
|
75
|
-
type: "boolean",
|
|
76
|
-
title: "Enable Disqus comments for this page.",
|
|
77
|
-
default: true,
|
|
78
|
-
},
|
|
79
|
-
identifier: {
|
|
80
|
-
type: "string",
|
|
81
|
-
title: "Identifier for this page.",
|
|
82
|
-
description: "Tells the Disqus service how to identify the current page",
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
const plugin = new plugin_1.default({
|
|
91
|
-
name: "test",
|
|
92
|
-
version: "4.0.0",
|
|
93
|
-
path: "/",
|
|
94
|
-
package: immutable_1.default.fromJS(testPkgRequireAlphaVersion),
|
|
95
|
-
content: immutable_1.default.fromJS({}),
|
|
96
|
-
});
|
|
97
|
-
return (0, validatePlugin_1.default)(plugin);
|
|
98
|
-
});
|
|
99
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conrefsLoader.d.ts","sourceRoot":"","sources":["../../../src/templating/__tests__/conrefsLoader.ts"],"names":[],"mappings":""}
|
|
@@ -1,90 +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 path_1 = __importDefault(require("path"));
|
|
7
|
-
const templateEngine_1 = __importDefault(require("../../models/templateEngine"));
|
|
8
|
-
const render_1 = __importDefault(require("../render"));
|
|
9
|
-
const conrefsLoader_1 = __importDefault(require("../conrefsLoader"));
|
|
10
|
-
describe("ConrefsLoader", () => {
|
|
11
|
-
const dirName = `${__dirname}/`;
|
|
12
|
-
const fileName = path_1.default.join(dirName, "test.md");
|
|
13
|
-
describe("Git", () => {
|
|
14
|
-
const engine = new templateEngine_1.default({
|
|
15
|
-
// @ts-expect-error: Expected 0 arguments, but got 1.
|
|
16
|
-
loader: new conrefsLoader_1.default(dirName),
|
|
17
|
-
});
|
|
18
|
-
test("should include content from git", () => {
|
|
19
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
|
|
20
|
-
return (0, render_1.default)(engine, fileName, '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md" %}').then((out) => {
|
|
21
|
-
expect(out.getContent()).toBe("Hello from git");
|
|
22
|
-
});
|
|
23
|
-
}, 60 * 1000);
|
|
24
|
-
test("should handle deep inclusion (1)", () => {
|
|
25
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
|
|
26
|
-
return (0, render_1.default)(engine, fileName, '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test2.md" %}').then((out) => {
|
|
27
|
-
expect(out.getContent()).toBe("First Hello. Hello from git");
|
|
28
|
-
});
|
|
29
|
-
}, 60 * 1000);
|
|
30
|
-
test("should handle deep inclusion (2)", () => {
|
|
31
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
|
|
32
|
-
return (0, render_1.default)(engine, fileName, '{% include "git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test3.md" %}').then((out) => {
|
|
33
|
-
expect(out.getContent()).toBe("First Hello. Hello from git");
|
|
34
|
-
});
|
|
35
|
-
}, 60 * 1000);
|
|
36
|
-
});
|
|
37
|
-
describe("Local", () => {
|
|
38
|
-
const engine = new templateEngine_1.default({
|
|
39
|
-
// @ts-expect-error: Expected 0 arguments, but got 1.
|
|
40
|
-
loader: new conrefsLoader_1.default(dirName),
|
|
41
|
-
});
|
|
42
|
-
describe("Relative", () => {
|
|
43
|
-
test("should resolve basic relative filepath", () => {
|
|
44
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
|
|
45
|
-
return (0, render_1.default)(engine, fileName, '{% include "include.md" %}').then((out) => {
|
|
46
|
-
expect(out.getContent()).toBe("Hello World");
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
test("should resolve basic parent filepath", () => {
|
|
50
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
|
|
51
|
-
return (0, render_1.default)(engine, path_1.default.join(dirName, "hello/test.md"), '{% include "../include.md" %}').then((out) => {
|
|
52
|
-
expect(out.getContent()).toBe("Hello World");
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
describe("Absolute", () => {
|
|
57
|
-
test("should resolve absolute filepath", () => {
|
|
58
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
|
|
59
|
-
return (0, render_1.default)(engine, fileName, '{% include "/include.md" %}').then((out) => {
|
|
60
|
-
expect(out.getContent()).toBe("Hello World");
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
test("should resolve absolute filepath when in a directory", () => {
|
|
64
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
|
|
65
|
-
return (0, render_1.default)(engine, path_1.default.join(dirName, "hello/test.md"), '{% include "/include.md" %}').then((out) => {
|
|
66
|
-
expect(out.getContent()).toBe("Hello World");
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
describe("transform", () => {
|
|
72
|
-
function transform(filePath, source) {
|
|
73
|
-
expect(typeof filePath).toBe("string");
|
|
74
|
-
expect(typeof source).toBe("string");
|
|
75
|
-
expect(filePath).toBe(path_1.default.resolve(__dirname, "include.md"));
|
|
76
|
-
expect(source).toBe("Hello World");
|
|
77
|
-
return `test-${source}-endtest`;
|
|
78
|
-
}
|
|
79
|
-
const engine = new templateEngine_1.default({
|
|
80
|
-
// @ts-expect-error: Expected 0 arguments, but got 1.
|
|
81
|
-
loader: new conrefsLoader_1.default(dirName, transform),
|
|
82
|
-
});
|
|
83
|
-
test("should transform included content", () => {
|
|
84
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
|
|
85
|
-
return (0, render_1.default)(engine, fileName, '{% include "include.md" %}').then((out) => {
|
|
86
|
-
expect(out.getContent()).toBe("test-Hello World-endtest");
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postRender.d.ts","sourceRoot":"","sources":["../../../src/templating/__tests__/postRender.ts"],"names":[],"mappings":""}
|
|
@@ -1,52 +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 templateEngine_1 = __importDefault(require("../../models/templateEngine"));
|
|
7
|
-
const templateBlock_1 = __importDefault(require("../../models/templateBlock"));
|
|
8
|
-
const render_1 = __importDefault(require("../render"));
|
|
9
|
-
const postRender_1 = __importDefault(require("../postRender"));
|
|
10
|
-
describe("postRender", () => {
|
|
11
|
-
let testPost;
|
|
12
|
-
const engine = templateEngine_1.default.create({
|
|
13
|
-
blocks: [
|
|
14
|
-
templateBlock_1.default.create("lower", (blk) => {
|
|
15
|
-
return blk.body.toLowerCase();
|
|
16
|
-
}),
|
|
17
|
-
templateBlock_1.default.create("prefix", (blk) => {
|
|
18
|
-
return {
|
|
19
|
-
body: `_${blk.body}_`,
|
|
20
|
-
post: function () {
|
|
21
|
-
testPost = true;
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
}),
|
|
25
|
-
],
|
|
26
|
-
});
|
|
27
|
-
test("should correctly replace block", () => {
|
|
28
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
|
|
29
|
-
return (0, render_1.default)(engine, "README.md", "Hello {% lower %}Samy{% endlower %}")
|
|
30
|
-
.then((output) => {
|
|
31
|
-
expect(output.getContent()).toMatch(/Hello \{\{\-([\S]+)\-\}\}/);
|
|
32
|
-
expect(output.getBlocks().size).toBe(1);
|
|
33
|
-
return (0, postRender_1.default)(engine, output);
|
|
34
|
-
})
|
|
35
|
-
.then((result) => {
|
|
36
|
-
expect(result).toBe("Hello samy");
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
test("should correctly replace blocks", () => {
|
|
40
|
-
// @ts-expect-error ts-migrate(2554) FIXME: Expected 4 arguments, but got 3.
|
|
41
|
-
return (0, render_1.default)(engine, "README.md", "Hello {% lower %}Samy{% endlower %}{% prefix %}Pesse{% endprefix %}")
|
|
42
|
-
.then((output) => {
|
|
43
|
-
expect(output.getContent()).toMatch(/Hello \{\{\-([\S]+)\-\}\}\{\{\-([\S]+)\-\}\}/);
|
|
44
|
-
expect(output.getBlocks().size).toBe(2);
|
|
45
|
-
return (0, postRender_1.default)(engine, output);
|
|
46
|
-
})
|
|
47
|
-
.then((result) => {
|
|
48
|
-
expect(result).toBe("Hello samy_Pesse_");
|
|
49
|
-
expect(testPost).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replaceShortcuts.d.ts","sourceRoot":"","sources":["../../../src/templating/__tests__/replaceShortcuts.ts"],"names":[],"mappings":""}
|
|
@@ -1,27 +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 templateBlock_1 = __importDefault(require("../../models/templateBlock"));
|
|
8
|
-
const replaceShortcuts_1 = __importDefault(require("../replaceShortcuts"));
|
|
9
|
-
describe("replaceShortcuts", () => {
|
|
10
|
-
const blocks = immutable_1.default.List([
|
|
11
|
-
templateBlock_1.default.create("math", {
|
|
12
|
-
shortcuts: {
|
|
13
|
-
start: "$$",
|
|
14
|
-
end: "$$",
|
|
15
|
-
parsers: ["markdown"],
|
|
16
|
-
},
|
|
17
|
-
}),
|
|
18
|
-
]);
|
|
19
|
-
test("should correctly replace inline matches by block", () => {
|
|
20
|
-
const content = (0, replaceShortcuts_1.default)(blocks, "test.md", "Hello $$a = b$$");
|
|
21
|
-
expect(content).toBe("Hello {% math %}a = b{% endmath %}");
|
|
22
|
-
});
|
|
23
|
-
test("should correctly replace block matches", () => {
|
|
24
|
-
const content = (0, replaceShortcuts_1.default)(blocks, "test.md", "Hello\n$$\na = b\n$$\n");
|
|
25
|
-
expect(content).toBe("Hello\n{% math %}\na = b\n{% endmath %}\n");
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../src/utils/__tests__/git.ts"],"names":[],"mappings":""}
|
|
@@ -1,46 +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 path_1 = __importDefault(require("path"));
|
|
7
|
-
const git_1 = __importDefault(require("../git"));
|
|
8
|
-
describe("Git", () => {
|
|
9
|
-
describe("URL parsing", () => {
|
|
10
|
-
test("should correctly validate git urls", () => {
|
|
11
|
-
// HTTPS
|
|
12
|
-
expect(git_1.default.isUrl("git+https://github.com/Hello/world.git")).toBeTruthy();
|
|
13
|
-
// SSH
|
|
14
|
-
expect(git_1.default.isUrl("git+git@github.com:GitbookIO/gitbook.git/directory/README.md#e1594cde2c32e4ff48f6c4eff3d3d461743d74e1")).toBeTruthy();
|
|
15
|
-
// Non valid
|
|
16
|
-
expect(git_1.default.isUrl("https://github.com/Hello/world.git")).toBeFalsy();
|
|
17
|
-
expect(git_1.default.isUrl("README.md")).toBeFalsy();
|
|
18
|
-
}, 60 * 1000);
|
|
19
|
-
test("should parse HTTPS urls", () => {
|
|
20
|
-
const parts = git_1.default.parseUrl("git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md");
|
|
21
|
-
expect(parts.host).toBe("https://gist.github.com/69ea4542e4c8967d2fa7.git");
|
|
22
|
-
expect(parts.ref).toBe(null);
|
|
23
|
-
expect(parts.filepath).toBe("test.md");
|
|
24
|
-
}, 60 * 1000);
|
|
25
|
-
test("should parse HTTPS urls with a reference", () => {
|
|
26
|
-
const parts = git_1.default.parseUrl("git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md#1.0.0");
|
|
27
|
-
expect(parts.host).toBe("https://gist.github.com/69ea4542e4c8967d2fa7.git");
|
|
28
|
-
expect(parts.ref).toBe("1.0.0");
|
|
29
|
-
expect(parts.filepath).toBe("test.md");
|
|
30
|
-
}, 60 * 1000);
|
|
31
|
-
test("should parse SSH urls", () => {
|
|
32
|
-
const parts = git_1.default.parseUrl("git+git@github.com:GitbookIO/gitbook.git/directory/README.md#e1594cde2c32e4ff48f6c4eff3d3d461743d74e1");
|
|
33
|
-
expect(parts.host).toBe("git@github.com:GitbookIO/gitbook.git");
|
|
34
|
-
expect(parts.ref).toBe("e1594cde2c32e4ff48f6c4eff3d3d461743d74e1");
|
|
35
|
-
expect(parts.filepath).toBe("directory/README.md");
|
|
36
|
-
}, 60 * 1000);
|
|
37
|
-
});
|
|
38
|
-
describe("Cloning and resolving", () => {
|
|
39
|
-
test("should clone an HTTPS url", () => {
|
|
40
|
-
const git = new git_1.default();
|
|
41
|
-
return git.resolve("git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md").then((filename) => {
|
|
42
|
-
expect(path_1.default.extname(filename)).toBe(".md");
|
|
43
|
-
});
|
|
44
|
-
}, 60 * 1000);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../src/utils/__tests__/location.ts"],"names":[],"mappings":""}
|
|
@@ -1,81 +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 location_1 = __importDefault(require("../location"));
|
|
7
|
-
describe("LocationUtils", () => {
|
|
8
|
-
test("should correctly test external location", () => {
|
|
9
|
-
expect(location_1.default.isExternal("http://google.fr")).toBe(true);
|
|
10
|
-
expect(location_1.default.isExternal("https://google.fr")).toBe(true);
|
|
11
|
-
expect(location_1.default.isExternal("test.md")).toBe(false);
|
|
12
|
-
expect(location_1.default.isExternal("folder/test.md")).toBe(false);
|
|
13
|
-
expect(location_1.default.isExternal("/folder/test.md")).toBe(false);
|
|
14
|
-
expect(location_1.default.isExternal("data:image/png")).toBe(false);
|
|
15
|
-
});
|
|
16
|
-
test("should correctly test data:uri location", () => {
|
|
17
|
-
expect(location_1.default.isDataURI("data:image/png")).toBe(true);
|
|
18
|
-
expect(location_1.default.isDataURI("http://google.fr")).toBe(false);
|
|
19
|
-
expect(location_1.default.isDataURI("https://google.fr")).toBe(false);
|
|
20
|
-
expect(location_1.default.isDataURI("test.md")).toBe(false);
|
|
21
|
-
expect(location_1.default.isDataURI("data.md")).toBe(false);
|
|
22
|
-
});
|
|
23
|
-
test("should correctly detect anchor location", () => {
|
|
24
|
-
expect(location_1.default.isAnchor("#test")).toBe(true);
|
|
25
|
-
expect(location_1.default.isAnchor(" #test")).toBe(true);
|
|
26
|
-
expect(location_1.default.isAnchor("https://google.fr#test")).toBe(false);
|
|
27
|
-
expect(location_1.default.isAnchor("test.md#test")).toBe(false);
|
|
28
|
-
});
|
|
29
|
-
describe(".relative", () => {
|
|
30
|
-
test("should resolve to a relative path (same folder)", () => {
|
|
31
|
-
expect(location_1.default.relative("links/", "links/test.md")).toBe("test.md");
|
|
32
|
-
});
|
|
33
|
-
test("should resolve to a relative path (parent folder)", () => {
|
|
34
|
-
expect(location_1.default.relative("links/", "test.md")).toBe("../test.md");
|
|
35
|
-
});
|
|
36
|
-
test("should resolve to a relative path (child folder)", () => {
|
|
37
|
-
expect(location_1.default.relative("links/", "links/hello/test.md")).toBe("hello/test.md");
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
describe(".flatten", () => {
|
|
41
|
-
test("should remove leading slash", () => {
|
|
42
|
-
expect(location_1.default.flatten("/test.md")).toBe("test.md");
|
|
43
|
-
expect(location_1.default.flatten("/hello/cool.md")).toBe("hello/cool.md");
|
|
44
|
-
});
|
|
45
|
-
test("should remove leading slashes", () => {
|
|
46
|
-
expect(location_1.default.flatten("///test.md")).toBe("test.md");
|
|
47
|
-
});
|
|
48
|
-
test("should not break paths", () => {
|
|
49
|
-
expect(location_1.default.flatten("hello/cool.md")).toBe("hello/cool.md");
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
describe(".toAbsolute", () => {
|
|
53
|
-
test("should correctly transform as absolute", () => {
|
|
54
|
-
// @ts-expect-error
|
|
55
|
-
expect(location_1.default.toAbsolute("http://google.fr")).toBe("http://google.fr");
|
|
56
|
-
expect(location_1.default.toAbsolute("test.md", "./", "./")).toBe("test.md");
|
|
57
|
-
expect(location_1.default.toAbsolute("folder/test.md", "./", "./")).toBe("folder/test.md");
|
|
58
|
-
});
|
|
59
|
-
test("should correctly handle windows path", () => {
|
|
60
|
-
expect(location_1.default.toAbsolute("folder\\test.md", "./", "./")).toBe("folder/test.md");
|
|
61
|
-
});
|
|
62
|
-
test("should correctly handle absolute path", () => {
|
|
63
|
-
expect(location_1.default.toAbsolute("/test.md", "./", "./")).toBe("test.md");
|
|
64
|
-
expect(location_1.default.toAbsolute("/test.md", "test", "test")).toBe("../test.md");
|
|
65
|
-
expect(location_1.default.toAbsolute("/sub/test.md", "test", "test")).toBe("../sub/test.md");
|
|
66
|
-
expect(location_1.default.toAbsolute("/test.png", "folder", "")).toBe("test.png");
|
|
67
|
-
});
|
|
68
|
-
test("should correctly handle absolute path (windows)", () => {
|
|
69
|
-
expect(location_1.default.toAbsolute("\\test.png", "folder", "")).toBe("test.png");
|
|
70
|
-
});
|
|
71
|
-
test("should resolve path starting by \"/\" in root directory", () => {
|
|
72
|
-
expect(location_1.default.toAbsolute("/test/hello.md", "./", "./")).toBe("test/hello.md");
|
|
73
|
-
});
|
|
74
|
-
test("should resolve path starting by \"/\" in child directory", () => {
|
|
75
|
-
expect(location_1.default.toAbsolute("/test/hello.md", "./hello", "./")).toBe("test/hello.md");
|
|
76
|
-
});
|
|
77
|
-
test("should resolve path starting by \"/\" in child directory, with same output directory", () => {
|
|
78
|
-
expect(location_1.default.toAbsolute("/test/hello.md", "./hello", "./hello")).toBe("../test/hello.md");
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/utils/__tests__/path.ts"],"names":[],"mappings":""}
|
|
@@ -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 path_1 = __importDefault(require("path"));
|
|
7
|
-
const path_2 = __importDefault(require("../path"));
|
|
8
|
-
describe("Paths", () => {
|
|
9
|
-
describe("setExtension", () => {
|
|
10
|
-
test("should correctly change extension of filename", () => {
|
|
11
|
-
expect(path_2.default.setExtension("test.md", ".html")).toBe("test.html");
|
|
12
|
-
expect(path_2.default.setExtension("test.md", ".json")).toBe("test.json");
|
|
13
|
-
});
|
|
14
|
-
test("should correctly change extension of path", () => {
|
|
15
|
-
expect(path_2.default.setExtension("hello/test.md", ".html")).toBe(path_1.default.normalize("hello/test.html"));
|
|
16
|
-
expect(path_2.default.setExtension("hello/test.md", ".json")).toBe(path_1.default.normalize("hello/test.json"));
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|